[gnome-terminal/gnome-3-12] app: Don't change the title on tab labels that no longer exist (take 2)



commit f8713e156f9398fca1aecf9c00c20c0dcc69ac70
Author: Egmont Koblinger <egmont gmail com>
Date:   Fri May 30 15:11:45 2014 +0200

    app: Don't change the title on tab labels that no longer exist (take 2)
    
    This fixes a potential crash when a tab is moved to another window,
    and later the title of that terminal changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730389
    (cherry picked from commit f65261a0b5d03658be3acb439976fd8af6fa28ea)

 src/terminal-tab-label.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/terminal-tab-label.c b/src/terminal-tab-label.c
index 90bab28..13ac248 100644
--- a/src/terminal-tab-label.c
+++ b/src/terminal-tab-label.c
@@ -210,6 +210,23 @@ terminal_tab_label_constructor (GType type,
 }
 
 static void
+terminal_tab_label_dispose (GObject *object)
+{
+  TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
+  TerminalTabLabelPrivate *priv = tab_label->priv;
+
+  if (priv->screen != NULL) {
+    g_signal_handlers_disconnect_by_func (priv->screen,
+                                          G_CALLBACK (sync_tab_label),
+                                          priv->label);
+    g_object_unref (priv->screen);
+    priv->screen = NULL;
+  }
+
+  G_OBJECT_CLASS (terminal_tab_label_parent_class)->dispose (object);
+}
+
+static void
 terminal_tab_label_finalize (GObject *object)
 {
 //   TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (object);
@@ -246,7 +263,7 @@ terminal_tab_label_set_property (GObject *object,
 
   switch (prop_id) {
     case PROP_SCREEN:
-      priv->screen = g_value_get_object (value);
+      priv->screen = g_value_dup_object (value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -261,6 +278,7 @@ terminal_tab_label_class_init (TerminalTabLabelClass *klass)
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
   gobject_class->constructor = terminal_tab_label_constructor;
+  gobject_class->dispose = terminal_tab_label_dispose;
   gobject_class->finalize = terminal_tab_label_finalize;
   gobject_class->get_property = terminal_tab_label_get_property;
   gobject_class->set_property = terminal_tab_label_set_property;


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