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
This commit is contained in:
Jasper St. Pierre 2011-11-27 20:56:58 -05:00
parent b0ae596de8
commit f6508b51a2

View File

@ -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);
}