changeset 29577:3bab2237724d

Properly free PurpleMediaBackendFs2Stream's.
author maiku@pidgin.im
date Tue, 27 Oct 2009 17:48:26 +0000
parents a27e41f373db
children dfc724880907
files libpurple/media/backend-fs2.c libpurple/media/media.c
diffstat 2 files changed, 36 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/media/backend-fs2.c	Tue Oct 27 00:13:39 2009 +0000
+++ b/libpurple/media/backend-fs2.c	Tue Oct 27 17:48:26 2009 +0000
@@ -154,6 +154,7 @@
 {
 	PurpleMediaBackendFs2Private *priv =
 			PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
+	GList *iter = NULL;
 
 	purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
 
@@ -211,6 +212,14 @@
 		priv->participants = NULL;
 	}
 
+	for (iter = priv->streams; iter; iter = g_list_next(iter)) {
+		PurpleMediaBackendFs2Stream *stream = iter->data;
+		if (stream->stream) {
+			g_object_unref(stream->stream);
+			stream->stream = NULL;
+		}
+	}
+
 	if (priv->media) {
 		g_object_remove_weak_pointer(G_OBJECT(priv->media),
 				(gpointer*)&priv->media);
@@ -230,6 +239,33 @@
 
 	g_free(priv->conference_type);
 
+	for (; priv->streams; priv->streams =
+			g_list_delete_link(priv->streams, priv->streams)) {
+		PurpleMediaBackendFs2Stream *stream = priv->streams->data;
+
+		/* Remove the connected_cb timeout */
+		if (stream->connected_cb_id != 0)
+			purple_timeout_remove(stream->connected_cb_id);
+
+		g_free(stream->participant);
+
+		if (stream->local_candidates)
+			fs_candidate_list_destroy(stream->local_candidates);
+
+		if (stream->remote_candidates)
+			fs_candidate_list_destroy(stream->remote_candidates);
+
+		if (stream->active_local_candidates)
+			fs_candidate_list_destroy(
+					stream->active_local_candidates);
+
+		if (stream->active_remote_candidates)
+			fs_candidate_list_destroy(
+					stream->active_remote_candidates);
+
+		g_free(stream);
+	}
+
 	if (priv->sessions) {
 		GList *sessions = g_hash_table_get_values(priv->sessions);
 
--- a/libpurple/media/media.c	Tue Oct 27 00:13:39 2009 +0000
+++ b/libpurple/media/media.c	Tue Oct 27 17:48:26 2009 +0000
@@ -350,7 +350,6 @@
 purple_media_dispose(GObject *media)
 {
 	PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
-	GList *iter = NULL;
 
 	purple_debug_info("media","purple_media_dispose\n");
 
@@ -361,14 +360,6 @@
 		priv->backend = NULL;
 	}
 
-	for (iter = priv->streams; iter; iter = g_list_next(iter)) {
-		PurpleMediaStream *stream = iter->data;
-		if (stream->stream) {
-			g_object_unref(stream->stream);
-			stream->stream = NULL;
-		}
-	}
-
 	if (priv->gst_bus_handler_id != 0) {
 		GstElement *pipeline = purple_media_manager_get_pipeline(
 				priv->manager);