Mesa (9.0): wayland: Destroy frame callback when destroying surface
Ian Romanick
idr at kemper.freedesktop.org
Thu Nov 8 18:50:29 UTC 2012
Module: Mesa
Branch: 9.0
Commit: 2332bc26d435e465a6f6571ab267db2a33ce05d2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2332bc26d435e465a6f6571ab267db2a33ce05d2
Author: Jonas Ådahl <jadahl at gmail.com>
Date: Sun Oct 28 00:50:12 2012 +0200
wayland: Destroy frame callback when destroying surface
If a frame callback is not destroyed when destroying a surface, its
handler function will be invoked if the surface was destroyed after the
callback was requested but before it was invoked, causing a write on
free:ed memory.
This can happen if eglDestroySurface() is called shortly after
eglSwapBuffers().
Note: This is a candidate for stable branches.
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
(cherry picked from commit a3b6b2d3055070da9bf7054fecfd0b171c398eb7)
---
src/egl/drivers/dri2/platform_wayland.c | 3 +++
.../state_trackers/egl/wayland/native_wayland.c | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index dcf3601..2fde171 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -213,6 +213,9 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
dri2_surf->third_buffer);
}
+ if (dri2_surf->frame_callback)
+ wl_callback_destroy(dri2_surf->frame_callback);
+
free(surf);
return EGL_TRUE;
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index 62c87f3..560e40d 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -355,6 +355,9 @@ wayland_surface_destroy(struct native_surface *nsurf)
wl_buffer_destroy(surface->buffer[buffer]);
}
+ if (surface->frame_callback)
+ wl_callback_destroy(surface->frame_callback);
+
resource_surface_destroy(surface->rsurf);
FREE(surface);
}
More information about the mesa-commit
mailing list