]> git.0d.be Git - empathy.git/commitdiff
ref the contact temporally when setting properties because it could destroy the object.
authorXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 Apr 2008 09:42:22 +0000 (09:42 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Wed, 2 Apr 2008 09:42:22 +0000 (09:42 +0000)
svn path=/trunk/; revision=855

libempathy/empathy-contact.c

index ec91f3a00740cd3c5b26cdea1946a2a5ca86d420..d1c6b82848bf000cd5026baf2fb24f6601e78dc5 100644 (file)
@@ -381,13 +381,14 @@ empathy_contact_set_id (EmpathyContact *contact,
 
        g_free (priv->id);
        priv->id = g_strdup (id);
+       g_object_ref (contact);
        contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_ID,
                                !G_STR_EMPTY (id));
-
        g_object_notify (G_OBJECT (contact), "id");
        if (G_STR_EMPTY (priv->name)) {
                g_object_notify (G_OBJECT (contact), "name");
        }
+       g_object_unref (contact);
 }
 
 const gchar *
@@ -422,10 +423,12 @@ empathy_contact_set_name (EmpathyContact *contact,
 
        g_free (priv->name);
        priv->name = g_strdup (name);
+
+       g_object_ref (contact);
        contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_NAME,
                                name != NULL);
-
        g_object_notify (G_OBJECT (contact), "name");
+       g_object_unref (contact);
 }
 
 EmpathyAvatar *
@@ -589,10 +592,12 @@ empathy_contact_set_handle (EmpathyContact *contact,
        }
 
        priv->handle = handle;
+
+       g_object_ref (contact);
        contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE,
                                handle != 0);
-
        g_object_notify (G_OBJECT (contact), "handle");
+       g_object_unref (contact);
 }
 
 EmpathyCapabilities