/pidgin/main: b52be4fef1de: Fix gstreamer elements references

Youness Alaoui kakaroto at kakaroto.homelinux.net
Sun Nov 23 23:22:49 EST 2014


Changeset: b52be4fef1ded825e262095480915f2c675a5694
Author:	 Youness Alaoui <kakaroto at kakaroto.homelinux.net>
Date:	 2014-07-08 22:59 -0400
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/b52be4fef1de

Description:

Fix gstreamer elements references
In backend-fs2, the create_src will unref the src after it's done with
it, if we simply return the created source, it will segfault.
The issue never happened before because every source so far also has
the UNIQUE flag, which causes it to go in a different branch of the
code which does ref the element and add it to the bin.

Refs #16315

diffstat:

 libpurple/mediamanager.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -443,7 +443,11 @@ purple_media_manager_set_video_caps(Purp
 
 		if (src) {
 			GstElement *capsfilter = gst_bin_get_by_name(GST_BIN(src), "prpl_video_caps");
-			g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
+			if (capsfilter) {
+				g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
+				gst_object_unref (capsfilter);
+			}
+			gst_object_unref (src);
 		}
 
 		g_free(id);
@@ -550,6 +554,11 @@ purple_media_manager_get_element(PurpleM
 	} else {
 		ret = purple_media_element_info_call_create(info,
 				media, session_id, participant);
+		if (element_type & PURPLE_MEDIA_ELEMENT_SRC) {
+			gst_object_ref(ret);
+			gst_bin_add(GST_BIN(purple_media_manager_get_pipeline(manager)),
+				ret);
+		}
 	}
 
 	if (ret == NULL)



More information about the Commits mailing list