diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:48:19 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:48:19 +0800 |
commit | aa2582564da8733bea469e473c24e5ee10c3874f (patch) | |
tree | 715a0186bbe5bd784bd1ce5d0674693165cdeefe | |
parent | bd528ebb64b07fe567d0f262c2fd10e37074d177 (diff) | |
download | gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar.gz gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar.bz2 gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar.lz gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar.xz gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.tar.zst gsoc2013-empathy-aa2582564da8733bea469e473c24e5ee10c3874f.zip |
Drop our references in dispose instead of finalize.
svn path=/trunk/; revision=2069
-rw-r--r-- | libempathy/empathy-contact-monitor.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libempathy/empathy-contact-monitor.c b/libempathy/empathy-contact-monitor.c index e48f08655..b024e1b86 100644 --- a/libempathy/empathy-contact-monitor.c +++ b/libempathy/empathy-contact-monitor.c @@ -35,6 +35,8 @@ typedef struct { EmpathyContactList *proxy; GPtrArray *contacts; + + gboolean dispose_run; } EmpathyContactMonitorPriv; enum { @@ -111,8 +113,6 @@ do_finalize (GObject *obj) priv = GET_PRIV (obj); if (priv->contacts) { - g_ptr_array_foreach (priv->contacts, - (GFunc) contact_remove_foreach, obj); g_ptr_array_free (priv->contacts, TRUE); priv->contacts = NULL; } @@ -126,11 +126,38 @@ do_finalize (GObject *obj) } static void +do_dispose (GObject *obj) +{ + EmpathyContactMonitorPriv *priv; + + priv = GET_PRIV (obj); + + if (priv->dispose_run) { + return; + } + + if (priv->contacts) { + g_ptr_array_foreach (priv->contacts, + (GFunc) contact_remove_foreach, obj); + } + + if (priv->proxy) { + g_signal_handlers_disconnect_by_func (priv->proxy, + cl_members_changed_cb, obj); + } + + priv->dispose_run = TRUE; + + G_OBJECT_CLASS (empathy_contact_monitor_parent_class)->dispose (obj); +} + +static void empathy_contact_monitor_class_init (EmpathyContactMonitorClass *klass) { GObjectClass *oclass = G_OBJECT_CLASS (klass); oclass->finalize = do_finalize; + oclass->dispose = do_dispose; oclass->get_property = do_get_property; oclass->set_property = do_set_property; @@ -225,6 +252,7 @@ empathy_contact_monitor_init (EmpathyContactMonitor *self) self->priv = priv; priv->contacts = NULL; priv->proxy = NULL; + priv->dispose_run = FALSE; } static void |