summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStencel, Joanna <joanna.stencel@intel.com>2016-08-22 09:48:50 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2016-08-24 10:18:13 +0100
commit690ead4a135aed68ddb8dcfceccd11adf27ff1f1 (patch)
treeddedc4b885db5bd0029f9188c4fe2595702f0143
parentf033d971557082ce716f5b722df0d923a265678e (diff)
egl/wayland-egl: Fix for segfault in dri2_wl_destroy_surface.
Segfault occurs when destroying EGL surface attached to already destroyed Wayland window. The fix is to set to NULL the pointer of surface's native window when wl_egl_destroy_window() is called. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Stencel, Joanna <joanna.stencel@intel.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--src/egl/wayland/wayland-egl/wayland-egl-priv.h1
-rw-r--r--src/egl/wayland/wayland-egl/wayland-egl.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
index f1e3ba28309..c91f9cdf0fb 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h
+++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
@@ -27,6 +27,7 @@ struct wl_egl_window {
void *private;
void (*resize_callback)(struct wl_egl_window *, void *);
+ void (*destroy_window_callback)(void *);
};
#ifdef __cplusplus
diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c
index 80a5be5e32c..4a4701a2de7 100644
--- a/src/egl/wayland/wayland-egl/wayland-egl.c
+++ b/src/egl/wayland/wayland-egl/wayland-egl.c
@@ -66,6 +66,7 @@ wl_egl_window_create(struct wl_surface *surface,
egl_window->surface = surface;
egl_window->private = NULL;
egl_window->resize_callback = NULL;
+ egl_window->destroy_window_callback = NULL;
wl_egl_window_resize(egl_window, width, height, 0, 0);
egl_window->attached_width = 0;
egl_window->attached_height = 0;
@@ -76,6 +77,8 @@ wl_egl_window_create(struct wl_surface *surface,
WL_EGL_EXPORT void
wl_egl_window_destroy(struct wl_egl_window *egl_window)
{
+ if (egl_window->destroy_window_callback)
+ egl_window->destroy_window_callback(egl_window->private);
free(egl_window);
}