# HG changeset patch # User Mike Ruprecht # Date 1233792913 0 # Node ID 218f052b9bf566aad75a4485578384960ba69f0c # Parent 1aed9a92b6573f347fbcde454d466432a34a3bdb Fix removing output windows when the session is rejected. diff -r 1aed9a92b657 -r 218f052b9bf5 libpurple/media.c --- a/libpurple/media.c Mon Feb 02 09:58:14 2009 +0000 +++ b/libpurple/media.c Thu Feb 05 00:15:13 2009 +0000 @@ -2390,12 +2390,30 @@ 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 @@ /* 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) {