[gnome-shell] st-im-text: Guard against multiple dispose



commit f6508b51a2a4ba2f16743599aaed1417e1793203
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Nov 27 20:56:58 2011 -0500

    st-im-text: Guard against multiple dispose
    
    This could cause warnings like "invalid (NULL) pointer instance"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=665000

 src/st/st-im-text.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-im-text.c b/src/st/st-im-text.c
index 8c24440..a3ff24d 100644
--- a/src/st/st-im-text.c
+++ b/src/st/st-im-text.c
@@ -88,12 +88,15 @@ st_im_text_dispose (GObject *object)
 {
   StIMTextPrivate *priv = ST_IM_TEXT (object)->priv;
 
-  g_signal_handlers_disconnect_by_func (priv->im_context,
-                                        (void *) st_im_text_commit_cb,
-                                        object);
+  if (priv->im_context != NULL)
+    {
+      g_signal_handlers_disconnect_by_func (priv->im_context,
+                                            (void *) st_im_text_commit_cb,
+                                            object);
 
-  g_object_unref (priv->im_context);
-  priv->im_context = NULL;
+      g_object_unref (priv->im_context);
+      priv->im_context = NULL;
+    }
 
   G_OBJECT_CLASS (st_im_text_parent_class)->dispose (object);
 }



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