pidgin.vv: 8abcc615: Fix removing output windows when the ses...

maiku at soc.pidgin.im maiku at soc.pidgin.im
Wed Feb 4 19:20:28 EST 2009


-----------------------------------------------------------------
Revision: 8abcc61528a93f4c18a6e1f200a7ba69f1694c28
Ancestor: 23b9058df46a6336d6a8e18ae93a4f3e96959fe7
Author: maiku at soc.pidgin.im
Date: 2009-02-05T00:15:13
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/8abcc61528a93f4c18a6e1f200a7ba69f1694c28

Modified files:
        libpurple/media.c

ChangeLog: 

Fix removing output windows when the session is rejected.

-------------- next part --------------
============================================================
--- libpurple/media.c	59822cc843ea80104526dc3e262a3c79572a6a34
+++ libpurple/media.c	e2ef7645f360b887a83b9b314c509c1c885fa82c
@@ -2390,12 +2390,30 @@ purple_media_remove_output_window(Purple
 
 	if (session_id != NULL && participant == NULL) {
 		PurpleMediaSession *session;
+		GstPad *pad, *peer;
+
 		session = purple_media_get_session(media, session_id);
 
 		if (session == NULL)
 			return FALSE;
 
 		sink = session->sink;
+
+		if (!GST_IS_ELEMENT(sink))
+			return FALSE;
+
+		pad = gst_element_get_static_pad(sink, "ghostsink");
+		peer = gst_pad_get_peer(pad);
+		gst_object_unref(pad);
+
+		gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer);
+		gst_object_unref(peer);
+
+		gst_element_set_state(sink, GST_STATE_NULL);
+
+		gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(sink)), sink);
+		session->sink = NULL;
+		return TRUE;	
 	} else if (session_id != NULL && participant != NULL) {
 		PurpleMediaStream *stream;
 		stream = purple_media_get_stream(media,
@@ -2413,6 +2431,13 @@ purple_media_remove_output_window(Purple
 
 	/* Remove sink */
 	parent = GST_ELEMENT(gst_element_get_parent(sink));
+
+	if (parent == NULL) {
+		/* It's not added and therefore not linked */
+		gst_object_unref(sink);
+		return FALSE;
+	}
+
 	pad = gst_element_get_static_pad(sink, "ghostsink");
 
 	if (pad == NULL) {


More information about the Commits mailing list