aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-contact.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-13 05:51:26 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-13 05:51:26 +0800
commit8593923cf989c55c91ea8bf90dfa2a1c19befdf3 (patch)
tree3cbae65ca32753828826b4b161b9c5f883018949 /libempathy/empathy-contact.c
parent8d27b967fdad4a6ad04cf40724a89f4b450fa1c6 (diff)
downloadgsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar.gz
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar.bz2
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar.lz
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar.xz
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.tar.zst
gsoc2013-empathy-8593923cf989c55c91ea8bf90dfa2a1c19befdf3.zip
EmpathyContact keeps a ref to the factory.
svn path=/trunk/; revision=2228
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r--libempathy/empathy-contact.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 437b726bb..0b7a1401d 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -34,6 +34,7 @@
#include <libmissioncontrol/mc-enum-types.h>
#include "empathy-contact.h"
+#include "empathy-contact-factory.h"
#include "empathy-utils.h"
#include "empathy-enum-types.h"
#include "empathy-marshal.h"
@@ -43,6 +44,7 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContact)
typedef struct {
+ EmpathyContactFactory *factory;
gchar *id;
gchar *name;
EmpathyAvatar *avatar;
@@ -96,6 +98,22 @@ enum {
static guint signals[LAST_SIGNAL];
static void
+contact_dispose (GObject *object)
+{
+ EmpathyContactPriv *priv = GET_PRIV (object);
+
+ if (priv->account)
+ g_object_unref (priv->account);
+ priv->account = NULL;
+
+ if (priv->factory)
+ g_object_unref (priv->factory);
+ priv->factory = NULL;
+
+ G_OBJECT_CLASS (empathy_contact_parent_class)->dispose (object);
+}
+
+static void
empathy_contact_class_init (EmpathyContactClass *class)
{
GObjectClass *object_class;
@@ -103,6 +121,7 @@ empathy_contact_class_init (EmpathyContactClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->finalize = contact_finalize;
+ object_class->dispose = contact_dispose;
object_class->get_property = contact_get_property;
object_class->set_property = contact_set_property;
@@ -213,6 +232,10 @@ empathy_contact_init (EmpathyContact *contact)
EMPATHY_TYPE_CONTACT, EmpathyContactPriv);
contact->priv = priv;
+
+ /* Keep a ref to the factory to be sure it is not finalized while there is
+ * still contacts alive. */
+ priv->factory = empathy_contact_factory_dup_singleton ();
}
static void
@@ -244,9 +267,6 @@ contact_finalize (GObject *object)
if (priv->avatar)
empathy_avatar_unref (priv->avatar);
- if (priv->account)
- g_object_unref (priv->account);
-
G_OBJECT_CLASS (empathy_contact_parent_class)->finalize (object);
}