Avoiding emitting the "savedstatus-changed" signal twice when the savedstatus

Fri, 25 Apr 2008 15:37:21 +0000

author
Daniel Atallah <datallah@pidgin.im>
date
Fri, 25 Apr 2008 15:37:21 +0000
changeset 22868
7ef8674b5d1d
parent 22867
ba95299d6ed4
child 22869
3fc7a5fc49eb

Avoiding emitting the "savedstatus-changed" signal twice when the savedstatus
is set to idleaway. Also, NULL freed memory so that if plugins try to do stuff
they shouldn't do, we don't access it.

libpurple/savedstatuses.c file | annotate | diff | comparison | revisions
--- a/libpurple/savedstatuses.c	Fri Apr 25 05:53:48 2008 +0000
+++ b/libpurple/savedstatuses.c	Fri Apr 25 15:37:21 2008 +0000
@@ -1128,10 +1128,12 @@
 
 	g_list_free(accounts);
 
-	purple_savedstatus_set_idleaway(FALSE);
-
-	purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed",
-					 saved_status, old);
+	if (purple_savedstatus_is_idleaway()) {
+		purple_savedstatus_set_idleaway(FALSE);
+	} else {
+		purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed",
+					 	   saved_status, old);
+	}
 }
 
 void
@@ -1250,6 +1252,7 @@
 	}
 
 	g_hash_table_destroy(creation_times);
+	creation_times = NULL;
 
 	purple_signals_unregister_by_instance(purple_savedstatuses_get_handle());
 }

mercurial