monitor(s): Avoid trying to disconnect handlers on instances that do not exist anymore

This commit is contained in:
Thibault Saunier 2013-07-18 18:20:09 -04:00 committed by Thiago Santos
parent 0127706e09
commit 799b7a8c3e
3 changed files with 11 additions and 8 deletions

View file

@ -53,7 +53,7 @@ gst_qa_bin_monitor_dispose (GObject * object)
GstQaBinMonitor *monitor = GST_QA_BIN_MONITOR_CAST (object);
GstElement *bin = GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor);
if (monitor->element_added_id)
if (bin && monitor->element_added_id)
g_signal_handler_disconnect (bin, monitor->element_added_id);
g_list_free_full (monitor->element_monitors, g_object_unref);

View file

@ -52,7 +52,7 @@ gst_qa_element_monitor_dispose (GObject * object)
{
GstQaElementMonitor *monitor = GST_QA_ELEMENT_MONITOR_CAST (object);
if (monitor->pad_added_id)
if (GST_QA_MONITOR_GET_OBJECT (monitor) && monitor->pad_added_id)
g_signal_handler_disconnect (GST_QA_MONITOR_GET_OBJECT (monitor),
monitor->pad_added_id);

View file

@ -177,17 +177,20 @@ gst_qa_pad_monitor_dispose (GObject * object)
GstQaPadMonitor *monitor = GST_QA_PAD_MONITOR_CAST (object);
GstPad *pad = GST_QA_PAD_MONITOR_GET_PAD (monitor);
if (monitor->buffer_probe_id)
gst_pad_remove_data_probe (pad, monitor->buffer_probe_id);
if (monitor->event_probe_id)
gst_pad_remove_data_probe (pad, monitor->event_probe_id);
if (pad) {
if (monitor->buffer_probe_id)
gst_pad_remove_data_probe (pad, monitor->buffer_probe_id);
if (monitor->event_probe_id)
gst_pad_remove_data_probe (pad, monitor->event_probe_id);
g_signal_handlers_disconnect_by_func (pad, (GCallback) _parent_set_cb,
monitor);
}
if (monitor->expected_segment)
gst_event_unref (monitor->expected_segment);
g_signal_handlers_disconnect_by_func (pad, (GCallback) _parent_set_cb,
monitor);
G_OBJECT_CLASS (parent_class)->dispose (object);
}