monitor(s): Avoid trying to disconnect handlers on instances that do not exist anymore
authorThibault Saunier <thibault.saunier@collabora.com>
Thu, 18 Jul 2013 22:20:09 +0000 (18:20 -0400)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Fri, 19 Jul 2013 14:15:54 +0000 (11:15 -0300)
validate/gst/qa/gst-qa-bin-monitor.c
validate/gst/qa/gst-qa-element-monitor.c
validate/gst/qa/gst-qa-pad-monitor.c

index 1beae76..6ef4270 100644 (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);
index ce7b7b9..c478dbf 100644 (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);
 
index 0d64a60..210ab13 100644 (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);
 }