[Xfce4-commits] [apps/mousepad] 40/45: Disconnect font-name setting callback

noreply at xfce.org noreply at xfce.org
Fri Jul 11 13:03:45 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit f94cf638ff474e822fdda7c1aaf6993cff86f309
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Thu Jul 10 23:43:28 2014 -0700

    Disconnect font-name setting callback
    
    Otherwise GSettings keeps calling back to destructed views.
---
 mousepad/mousepad-view.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index d362973..7f0bd91 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -126,6 +126,7 @@ struct _MousepadView
   /* the font used in the view */
   gchar                *font_name;
   PangoFontDescription *font_desc;
+  gulong                font_handler;
 
   /* whitespace visualization */
   gboolean              show_whitespace;
@@ -262,6 +263,7 @@ mousepad_view_init (MousepadView *view)
   view->color_scheme = g_strdup ("none");
   view->font_name = NULL;
   view->font_desc = NULL;
+  view->font_handler = 0;
 
   /* make sure any buffers set on the view get the color scheme applied to them */
   g_signal_connect (view,
@@ -298,10 +300,11 @@ mousepad_view_init (MousepadView *view)
   BIND_ (WORD_WRAP,              "word-wrap");
 
   /* override with default font when the setting is enabled */
-  MOUSEPAD_SETTING_CONNECT (USE_DEFAULT_FONT,
-                            G_CALLBACK (mousepad_view_use_default_font_setting_changed),
-                            view,
-                            G_CONNECT_SWAPPED);
+  view->font_handler =
+    MOUSEPAD_SETTING_CONNECT (USE_DEFAULT_FONT,
+                              G_CALLBACK (mousepad_view_use_default_font_setting_changed),
+                              view,
+                              G_CONNECT_SWAPPED);
 
 #undef BIND_
 }
@@ -317,6 +320,10 @@ mousepad_view_finalize (GObject *object)
   if (G_UNLIKELY (view->selection_timeout_id != 0))
     g_source_remove (view->selection_timeout_id);
 
+  /* disconnect the settings changed callback */
+  if (view->font_handler > 0)
+    MOUSEPAD_SETTING_DISCONNECT (FONT_NAME, view->font_handler);
+
   /* free the selection marks list (marks are owned by the buffer) */
   if (G_UNLIKELY (view->selection_marks != NULL))
     g_slist_free (view->selection_marks);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list