wayland/surface: Disconnect actor handlers before unassigning role

The handlers depend on a role being assigned. Destroying the window
causes it to become unmapped, which would sometimes trigger one of the
handlers, resulting in an is-assigned assert hitting in one of the
handlers. Avoid this by disconnecting the handlers earlier, so that
there is no risk that any them being triggered before the role is
assigned.

https://bugzilla.gnome.org/show_bug.cgi?id=789552
This commit is contained in:
Jonas Ådahl 2017-10-27 18:32:21 +08:00
parent 8335a75ae5
commit 81341ec9a9

View File

@ -1324,6 +1324,16 @@ wl_surface_destructor (struct wl_resource *resource)
g_signal_emit (surface, surface_signals[SURFACE_DESTROY], 0);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_mapped_notify,
surface);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_allocation_notify,
surface);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_position_notify,
surface);
g_clear_object (&surface->role);
/* If we still have a window at the time of destruction, that means that
@ -1349,15 +1359,6 @@ wl_surface_destructor (struct wl_resource *resource)
if (surface->input_region)
cairo_region_destroy (surface->input_region);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_mapped_notify,
surface);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_allocation_notify,
surface);
g_signal_handlers_disconnect_by_func (surface->surface_actor,
surface_actor_position_notify,
surface);
g_object_unref (surface->surface_actor);
meta_wayland_compositor_destroy_frame_callbacks (compositor, surface);