cpw.maiku.media_refactor: a5ded9ac: Properly free PurpleMediaBackendFs2Strea...

maiku at pidgin.im maiku at pidgin.im
Tue Oct 27 20:28:07 EDT 2009


-----------------------------------------------------------------
Revision: a5ded9ac4f8af04224b34c7710b6ccc6ddd627fd
Ancestor: 15be10945e42ad1044265eccacb6159587b0a4f4
Author: maiku at pidgin.im
Date: 2009-10-27T17:48:26
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/a5ded9ac4f8af04224b34c7710b6ccc6ddd627fd

Modified files:
        libpurple/media/backend-fs2.c libpurple/media/media.c

ChangeLog: 

Properly free PurpleMediaBackendFs2Stream's.

-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c	147100f6359026a98e213963ab3104100a2d7e74
+++ libpurple/media/backend-fs2.c	8e391c7f78766e99bed29e14264da1dd71a41d07
@@ -154,6 +154,7 @@ purple_media_backend_fs2_dispose(GObject
 {
 	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 @@ purple_media_backend_fs2_dispose(GObject
 		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 @@ purple_media_backend_fs2_finalize(GObjec
 
 	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);
 
============================================================
--- libpurple/media/media.c	3d914e5a558a2c89a32ee7504c35826d876debb5
+++ libpurple/media/media.c	0692588b8e77698cccf909f1c243a79c74439fac
@@ -350,7 +350,6 @@ purple_media_dispose(GObject *media)
 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 @@ purple_media_dispose(GObject *media)
 		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);


More information about the Commits mailing list