summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@gnome.org>2016-01-22 19:38:53 +0100
committerThibault Saunier <thibault.saunier@collabora.com>2016-02-23 11:46:39 +0100
commitc2a944965ad869b5620128be7a8bf23975bb7873 (patch)
treebd7206df979286efefb67d1ea940278a2534ef8c
parent8c760b0a0e80cb0a1cc5062f7d19a0569bf05474 (diff)
validate: Guarantee that we never create 2 monitors for the same object
Differential Revision: https://phabricator.freedesktop.org/D702
-rw-r--r--validate/gst/validate/gst-validate-bin-monitor.c2
-rw-r--r--validate/gst/validate/gst-validate-element-monitor.c2
-rw-r--r--validate/gst/validate/gst-validate-monitor-factory.c11
3 files changed, 11 insertions, 4 deletions
diff --git a/validate/gst/validate/gst-validate-bin-monitor.c b/validate/gst/validate/gst-validate-bin-monitor.c
index fdb5125..241c606 100644
--- a/validate/gst/validate/gst-validate-bin-monitor.c
+++ b/validate/gst/validate/gst-validate-bin-monitor.c
@@ -207,8 +207,6 @@ gst_validate_bin_monitor_setup (GstValidateMonitor * monitor)
return FALSE;
}
- g_object_set_data ((GObject *) bin, "validate-monitor", bin_monitor);
-
bin_monitor->element_added_id =
g_signal_connect (bin, "element-added",
G_CALLBACK (_validate_bin_element_added), monitor);
diff --git a/validate/gst/validate/gst-validate-element-monitor.c b/validate/gst/validate/gst-validate-element-monitor.c
index 7d9f945..b518c21 100644
--- a/validate/gst/validate/gst-validate-element-monitor.c
+++ b/validate/gst/validate/gst-validate-element-monitor.c
@@ -248,8 +248,6 @@ gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor)
return FALSE;
}
- g_object_set_data ((GObject *) element, "validate-monitor", elem_monitor);
-
gst_validate_element_monitor_inspect (elem_monitor);
elem_monitor->pad_added_id = g_signal_connect (element, "pad-added",
diff --git a/validate/gst/validate/gst-validate-monitor-factory.c b/validate/gst/validate/gst-validate-monitor-factory.c
index cc3cb65..56ffc92 100644
--- a/validate/gst/validate/gst-validate-monitor-factory.c
+++ b/validate/gst/validate/gst-validate-monitor-factory.c
@@ -57,6 +57,14 @@ gst_validate_monitor_factory_create (GstObject * target,
GstValidateMonitor *monitor = NULL;
g_return_val_if_fail (target != NULL, NULL);
+ monitor = g_object_get_data ((GObject *) target, "validate-monitor");
+ if (monitor) {
+ GST_INFO_OBJECT (target, "Is already monitored by %" GST_PTR_FORMAT,
+ monitor);
+
+ return g_object_ref (monitor);
+ }
+
if (GST_IS_PAD (target)) {
monitor =
GST_VALIDATE_MONITOR_CAST (gst_validate_pad_monitor_new (GST_PAD_CAST
@@ -73,8 +81,11 @@ gst_validate_monitor_factory_create (GstObject * target,
monitor =
GST_VALIDATE_MONITOR_CAST (gst_validate_element_monitor_new
(GST_ELEMENT_CAST (target), runner, parent));
+ } else {
+ g_assert_not_reached ();
}
+ g_object_set_data ((GObject *) target, "validate-monitor", monitor);
gst_validate_override_registry_attach_overrides (monitor);
return monitor;
}