From 0a667858ab650ca11619b1681b01eb0ed2f8f71e Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 24 May 2016 14:04:50 +0000 Subject: [PATCH] validate: keep a ref when registering an override _add_override_from_struct() could, in theory, register more than once the same override so we should not transfer the ref. Reviewed-by: Thibault Saunier Differential Revision: https://phabricator.freedesktop.org/D956 --- validate/gst/overrides/gst-validate-default-overrides.c | 1 + validate/gst/validate/gst-validate-override-registry.c | 8 +++++--- validate/plugins/ssim/gstvalidatessim.c | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/validate/gst/overrides/gst-validate-default-overrides.c b/validate/gst/overrides/gst-validate-default-overrides.c index 9e2e96c7e7..1e547140c9 100644 --- a/validate/gst/overrides/gst-validate-default-overrides.c +++ b/validate/gst/overrides/gst-validate-default-overrides.c @@ -43,5 +43,6 @@ gst_validate_create_overrides (void) g_quark_from_string ("caps::is-missing-field"), GST_VALIDATE_REPORT_LEVEL_CRITICAL); gst_validate_override_register_by_name ("capsfilter0", o); + g_object_unref (o); return 1; } diff --git a/validate/gst/validate/gst-validate-override-registry.c b/validate/gst/validate/gst-validate-override-registry.c index 17808245bc..4c35a9aa08 100644 --- a/validate/gst/validate/gst-validate-override-registry.c +++ b/validate/gst/validate/gst-validate-override-registry.c @@ -134,7 +134,7 @@ gst_validate_override_register_by_name (const gchar * name, GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry); entry->name = g_strdup (name); - entry->override = override; + entry->override = g_object_ref (override); g_queue_push_tail (®istry->name_overrides, entry); GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry); } @@ -149,7 +149,7 @@ gst_validate_override_register_by_type (GType gtype, GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry); entry->gtype = gtype; - entry->override = override; + entry->override = g_object_ref (override); g_queue_push_tail (®istry->gtype_overrides, entry); GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry); } @@ -164,7 +164,7 @@ gst_validate_override_register_by_klass (const gchar * klass, GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry); entry->name = g_strdup (klass); - entry->override = override; + entry->override = g_object_ref (override); g_queue_push_tail (®istry->klass_overrides, entry); GST_VALIDATE_OVERRIDE_REGISTRY_UNLOCK (registry); } @@ -334,12 +334,14 @@ _add_override_from_struct (GstStructure * soverride) if (!issue) { + g_object_unref (override); return FALSE; } gst_validate_issue_set_default_level (issue, level); } + g_object_unref (override); return TRUE; } diff --git a/validate/plugins/ssim/gstvalidatessim.c b/validate/plugins/ssim/gstvalidatessim.c index 97b8908ba0..812c02bc29 100644 --- a/validate/plugins/ssim/gstvalidatessim.c +++ b/validate/plugins/ssim/gstvalidatessim.c @@ -787,6 +787,7 @@ gst_validate_ssim_init (GstPlugin * plugin) else g_assert_not_reached (); + g_object_unref (override); } else { GST_ERROR ("Wrong configuration '%" GST_PTR_FORMAT "'element-classification' and output-dir are mandatory fields",