changeset 26005:5c30047f960e

Properly free PurpleMedia when there's an error creating an FsStream.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 28 Aug 2008 04:57:30 +0000
parents f89bdd34c9f1
children 0baeafee93be
files libpurple/media.c libpurple/protocols/jabber/jingle.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media.c	Wed Aug 27 07:49:52 2008 +0000
+++ b/libpurple/media.c	Thu Aug 28 04:57:30 2008 +0000
@@ -1199,6 +1199,7 @@
 					   err->message);
 			g_error_free(err);
 			g_object_unref(participant);
+			g_hash_table_remove(media->priv->participants, who);
 			purple_media_remove_session(media, session);
 			g_free(session);
 			return FALSE;
--- a/libpurple/protocols/jabber/jingle.c	Wed Aug 27 07:49:52 2008 +0000
+++ b/libpurple/protocols/jabber/jingle.c	Thu Aug 28 04:57:30 2008 +0000
@@ -949,6 +949,8 @@
 		return FALSE;
 	}
 
+	jabber_jingle_session_set_media(session, media);
+
 	for (; contents; contents = g_list_delete_link(contents, contents)) {
 		JingleSessionContent *jsc = contents->data;
 		gboolean result = FALSE;
@@ -986,12 +988,11 @@
 
 		if (!result) {
 			purple_debug_error("jingle", "Couldn't create stream\n");
+			purple_media_hangup(media);
 			return FALSE;
 		}
 	}
 
-	jabber_jingle_session_set_media(session, media);
-
 	/* connect callbacks */
 	g_signal_connect_swapped(G_OBJECT(media), "accepted", 
 				 G_CALLBACK(jabber_jingle_session_send_session_accept), session);