mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-13 23:22:54 +00:00
validate: Guarantee that we never create 2 monitors for the same object
Differential Revision: https://phabricator.freedesktop.org/D702
This commit is contained in:
parent
8c760b0a0e
commit
c2a944965a
3 changed files with 11 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue