playsink: remove circular ref between bin and internal pad

... by not assigning an additional ref to an async blocked callback,
which should not be called anyway by the time the object is gone.

Fixes #672006.
This commit is contained in:
Mark Nauwelaerts 2012-03-14 11:04:25 +01:00
parent 787e896bde
commit 9fc640b9e0
2 changed files with 15 additions and 30 deletions

View file

@ -3382,8 +3382,7 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
@ -3391,8 +3390,7 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
@ -3400,8 +3398,7 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
}
@ -3446,8 +3443,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, TRUE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
@ -3455,8 +3451,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, TRUE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
@ -3464,8 +3459,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
gst_pad_set_blocked_async_full (opad, TRUE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, TRUE, sinkpad_blocked_cb, playsink);
gst_object_unref (opad);
}
GST_PLAY_SINK_UNLOCK (playsink);
@ -3579,8 +3573,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
GstPad *blockpad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res)));
gst_pad_set_blocked_async_full (blockpad, TRUE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (blockpad, TRUE, sinkpad_blocked_cb, playsink);
PENDING_FLAG_SET (playsink, type);
gst_object_unref (blockpad);
}
@ -3865,8 +3858,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
}
gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
@ -3877,8 +3869,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
}
gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
@ -3889,8 +3880,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
if (gst_pad_is_blocked (opad)) {
gst_pad_set_blocked_async_full (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_pad_set_blocked_async (opad, FALSE, sinkpad_blocked_cb, playsink);
}
gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;

View file

@ -254,8 +254,7 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkConvertBin * self)
unblock:
gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
(GstPadBlockCallback) pad_blocked_cb, self, NULL);
done:
GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
@ -338,8 +337,7 @@ gst_play_sink_convert_bin_sink_setcaps (GstPad * pad, GstCaps * caps)
reconfigure = TRUE;
gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
(GstPadBlockCallback) pad_blocked_cb, self, NULL);
}
if (target)
@ -350,8 +348,7 @@ gst_play_sink_convert_bin_sink_setcaps (GstPad * pad, GstCaps * caps)
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
reconfigure = TRUE;
gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
(GstPadBlockCallback) pad_blocked_cb, self, NULL);
}
}
@ -509,8 +506,7 @@ gst_play_sink_convert_bin_change_state (GstElement * element,
GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
if (gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked_async_full (self->sink_proxypad, FALSE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
(GstPadBlockCallback) pad_blocked_cb, self, NULL);
GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
@ -540,8 +536,7 @@ gst_play_sink_convert_bin_change_state (GstElement * element,
GST_PLAY_SINK_CONVERT_BIN_LOCK (self);
if (!gst_pad_is_blocked (self->sink_proxypad))
gst_pad_set_blocked_async_full (self->sink_proxypad, TRUE,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref);
(GstPadBlockCallback) pad_blocked_cb, self, NULL);
GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
break;
default: