From d6d377a44754520695f1fa558e21e8780c93b815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 16 Oct 2015 09:40:21 +0800 Subject: [PATCH] wayland: Set the xdg_popup pointer even when not mapping If we immediately dismiss the popup, we still need to set the surface->xdg_popup pointer field in order for the destructor to properly clean up the state. Not doing this may cause a crash if the xdg_popup resource that was immediately dismissed is destoryed after wl_surface during client destruction. https://bugzilla.gnome.org/show_bug.cgi?id=756675 --- src/wayland/meta-wayland-surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index f51b124e6..ba21d77a0 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1515,15 +1515,15 @@ xdg_shell_get_xdg_popup (struct wl_client *client, surface, xdg_popup_destructor); + surface->xdg_popup = popup_resource; + surface->xdg_shell_resource = resource; + if (!meta_wayland_pointer_can_popup (&seat->pointer, serial)) { xdg_popup_send_popup_done (popup_resource); return; } - surface->xdg_popup = popup_resource; - surface->xdg_shell_resource = resource; - surface->popup.parent = parent_surf; surface->popup.parent_destroy_listener.notify = handle_popup_parent_destroyed; wl_resource_add_destroy_listener (parent_surf->resource,