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
This commit is contained in:
Jonas Ådahl 2015-10-16 09:40:21 +08:00
parent ffd95c2ad5
commit d6d377a447

View File

@ -1515,15 +1515,15 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
surface, surface,
xdg_popup_destructor); xdg_popup_destructor);
surface->xdg_popup = popup_resource;
surface->xdg_shell_resource = resource;
if (!meta_wayland_pointer_can_popup (&seat->pointer, serial)) if (!meta_wayland_pointer_can_popup (&seat->pointer, serial))
{ {
xdg_popup_send_popup_done (popup_resource); xdg_popup_send_popup_done (popup_resource);
return; return;
} }
surface->xdg_popup = popup_resource;
surface->xdg_shell_resource = resource;
surface->popup.parent = parent_surf; surface->popup.parent = parent_surf;
surface->popup.parent_destroy_listener.notify = handle_popup_parent_destroyed; surface->popup.parent_destroy_listener.notify = handle_popup_parent_destroyed;
wl_resource_add_destroy_listener (parent_surf->resource, wl_resource_add_destroy_listener (parent_surf->resource,