[mutter] wayland/surface: Disconnect actor handlers before unassigning role



commit 07745b3082d4442fba2377c11f2082c85dd8f2af
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Oct 27 18:32:21 2017 +0800

    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 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 7dded19..bea809d 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]