From d04c8b6d2e0f94b1a31769cae118e61c2078b385 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 30 Dec 2013 19:03:22 +0100 Subject: [PATCH] pad: Keep an extra ref of the pad when calling an IDLE probe immediately The callback might destroy the pad. --- gst/gstpad.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/gstpad.c b/gst/gstpad.c index 6093138..db96d5f 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1288,6 +1288,9 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask, GstPadProbeInfo info = { GST_PAD_PROBE_TYPE_IDLE, res, }; GstPadProbeReturn ret; + /* Keep another ref, the callback could destroy the pad */ + gst_object_ref (pad); + /* the pad is idle now, we can signal the idle callback now */ GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "pad is idle, trigger idle callback"); @@ -1317,6 +1320,8 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask, break; } GST_OBJECT_UNLOCK (pad); + + gst_object_unref (pad); } } else { GST_OBJECT_UNLOCK (pad); -- 2.7.4