mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 17:30:20 +01:00
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>
This commit is contained in:
parent
f033d97155
commit
690ead4a13
2 changed files with 4 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ struct wl_egl_window {
|
||||||
|
|
||||||
void *private;
|
void *private;
|
||||||
void (*resize_callback)(struct wl_egl_window *, void *);
|
void (*resize_callback)(struct wl_egl_window *, void *);
|
||||||
|
void (*destroy_window_callback)(void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ wl_egl_window_create(struct wl_surface *surface,
|
||||||
egl_window->surface = surface;
|
egl_window->surface = surface;
|
||||||
egl_window->private = NULL;
|
egl_window->private = NULL;
|
||||||
egl_window->resize_callback = NULL;
|
egl_window->resize_callback = NULL;
|
||||||
|
egl_window->destroy_window_callback = NULL;
|
||||||
wl_egl_window_resize(egl_window, width, height, 0, 0);
|
wl_egl_window_resize(egl_window, width, height, 0, 0);
|
||||||
egl_window->attached_width = 0;
|
egl_window->attached_width = 0;
|
||||||
egl_window->attached_height = 0;
|
egl_window->attached_height = 0;
|
||||||
|
|
@ -76,6 +77,8 @@ wl_egl_window_create(struct wl_surface *surface,
|
||||||
WL_EGL_EXPORT void
|
WL_EGL_EXPORT void
|
||||||
wl_egl_window_destroy(struct wl_egl_window *egl_window)
|
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);
|
free(egl_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue