From f6508b51a2a4ba2f16743599aaed1417e1793203 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 27 Nov 2011 20:56:58 -0500 Subject: [PATCH] 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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/st/st-im-text.c b/src/st/st-im-text.c index 8c244403b..a3ff24de6 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); }