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 <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D956
This commit is contained in:
Guillaume Desmottes 2016-05-24 14:04:50 +00:00 committed by Thibault Saunier
parent f5c50b19ed
commit 0a667858ab
3 changed files with 7 additions and 3 deletions

View file

@ -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;
}

View file

@ -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 (&registry->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 (&registry->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 (&registry->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;
}

View file

@ -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",