From 07745b3082d4442fba2377c11f2082c85dd8f2af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 27 Oct 2017 18:32:21 +0800 Subject: [PATCH] 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 --- src/wayland/meta-wayland-surface.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 7dded19d6..bea809d86 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -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);