[gtk+] Disconnect signal handlers



commit f08df56211a225e9e874679daf5ad7c7a57ea942
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 10 18:21:58 2013 -0500

    Disconnect signal handlers
    
    We connect to notify::title on app-provided titlebars, but
    we forgot to disconnect the signal handler when unsetting
    the titlebar.

 gtk/gtkwindow.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index e1aea9c..f1bc2f4 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -558,6 +558,9 @@ static void gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
 
 static void ensure_state_flag_backdrop (GtkWidget *widget);
 static void unset_titlebar (GtkWindow *window);
+static void on_titlebar_title_notify (GtkHeaderBar *titlebar,
+                                      GParamSpec   *pspec,
+                                      GtkWindow    *self);
 
 G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
                          G_ADD_PRIVATE (GtkWindow)
@@ -3472,6 +3475,11 @@ unset_titlebar (GtkWindow *window)
 {
   GtkWindowPrivate *priv = window->priv;
 
+  if (priv->titlebar != NULL)
+    g_signal_handlers_disconnect_by_func (priv->titlebar,
+                                          on_titlebar_title_notify,
+                                          window);
+
   if (priv->title_box != NULL)
     {
       gtk_widget_unparent (priv->title_box);
@@ -3546,8 +3554,8 @@ gdk_window_enable_csd (GtkWindow *window)
 
 static void
 on_titlebar_title_notify (GtkHeaderBar *titlebar,
-                          GParamSpec *pspec,
-                          GtkWindow *self)
+                          GParamSpec   *pspec,
+                          GtkWindow    *self)
 {
   gtk_window_set_title_internal (self, gtk_header_bar_get_title (titlebar),
                                  FALSE);


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