/pidgin/main: d8392a432cac: Fix jingle termination.

Elliott Sales de Andrade qulogic at pidgin.im
Mon Nov 5 18:15:56 EST 2012


Changeset: d8392a432cac66810da6e6edf028472902a31310
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-09-09 22:36 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/d8392a432cac

Description:

Fix jingle termination.

If you unref the object, then it will destroy and remove itself from
the hash table. However, modifying the hash table is not allowed
during a foreach call.

diffstat:

 libpurple/protocols/jabber/jingle/jingle.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (27 lines):

diff --git a/libpurple/protocols/jabber/jingle/jingle.c b/libpurple/protocols/jabber/jingle/jingle.c
--- a/libpurple/protocols/jabber/jingle/jingle.c
+++ b/libpurple/protocols/jabber/jingle/jingle.c
@@ -429,18 +429,14 @@ jingle_parse(JabberStream *js, const cha
 	jingle_actions[action_type].handler(session, jingle);
 }
 
-static void
-jingle_terminate_sessions_gh(gpointer key, gpointer value, gpointer user_data)
-{
-	g_object_unref(value);
-}
-
 void
 jingle_terminate_sessions(JabberStream *js)
 {
-	if (js->sessions)
-		g_hash_table_foreach(js->sessions,
-				jingle_terminate_sessions_gh, NULL);
+	if (js->sessions) {
+		GList *list = g_hash_table_get_values(js->sessions);
+		for (; list; list = g_list_delete_link(list, list))
+			g_object_unref(list->data);
+	}
 }
 
 #ifdef USE_VV



More information about the Commits mailing list