diff --git a/gst/gstpad.c b/gst/gstpad.c index 6093138d03..db96d5fc99 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);