[gtk/wip/matthiasc/popup5: 148/152] x11: Disconnect from the frame clock



commit 3332d142f9d04d9a8479f984449c517a1bdd3998
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri May 24 01:55:57 2019 +0000

    x11: Disconnect from the frame clock
    
    The frame clock can now survive its surface,
    so we need to disconnect signal handlers.

 gdk/x11/gdksurface-x11.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index afdb6c243b..d98b4e6bbf 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -773,6 +773,25 @@ connect_frame_clock (GdkSurface *surface)
     }
 }
 
+static void
+disconnect_frame_clock (GdkSurface *surface)
+{
+  GdkX11Surface *impl;
+
+  impl = GDK_X11_SURFACE (surface);
+  if (impl->frame_clock_connected)
+    {
+      GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
+
+      g_signal_handlers_disconnect_by_func (frame_clock,
+                                            on_frame_clock_before_paint, surface);
+      g_signal_handlers_disconnect_by_func (frame_clock,
+                                            on_frame_clock_after_paint, surface);
+
+      impl->frame_clock_connected = FALSE;
+    }
+}
+
 GdkSurface *
 _gdk_x11_display_create_surface (GdkDisplay     *display,
                                  GdkSurfaceType  surface_type,
@@ -959,6 +978,7 @@ gdk_x11_surface_destroy (GdkSurface *surface,
     gdk_toplevel_x11_free_contents (GDK_SURFACE_DISPLAY (surface), toplevel);
 
   unhook_surface_changed (surface);
+  disconnect_frame_clock (surface);
 
   if (impl->cairo_surface)
     {


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