libpurple/presence.c

branch
soc.2013.gobjectification.plugins
changeset 36846
d6e55ebf2820
parent 36843
a81a985c60f4
parent 34986
894c29e33300
child 36872
c0099fc27ace
--- a/libpurple/presence.c	Tue Oct 01 05:50:40 2013 +0530
+++ b/libpurple/presence.c	Tue Oct 01 17:35:00 2013 +0530
@@ -423,10 +423,13 @@
 static void
 purple_presence_dispose(GObject *object)
 {
-	PURPLE_DBUS_UNREGISTER_POINTER(object);
+	PurplePresencePrivate *priv = PURPLE_PRESENCE_GET_PRIVATE(object);
 
-	g_list_foreach(PURPLE_PRESENCE_GET_PRIVATE(object)->statuses,
-			(GFunc)g_object_unref, NULL);
+	if (priv->statuses) {
+		g_list_foreach(priv->statuses, (GFunc)g_object_unref, NULL);
+		g_list_free(priv->statuses);
+		priv->statuses = NULL;
+	}
 
 	parent_class->dispose(object);
 }
@@ -437,9 +440,10 @@
 {
 	PurplePresencePrivate *priv = PURPLE_PRESENCE_GET_PRIVATE(object);
 
-	g_list_free(priv->statuses);
 	g_hash_table_destroy(priv->status_table);
 
+	PURPLE_DBUS_UNREGISTER_POINTER(object);
+
 	parent_class->finalize(object);
 }
 

mercurial