validate: runner: prevent hash table modifications while iterating

A GHashTableIter is invalided if the hash table is modified while we are
iterating. Prevent this by taking the runner lock.

Fix assertion warnings with
validate.file.transcode.to_vorbis_and_vp8_in_webm.Sintel_2010_720p_mkv_srt

Reviewed-by: Thibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1026
This commit is contained in:
Guillaume Desmottes 2016-05-27 13:23:48 +02:00 committed by Thibault Saunier
parent 5a745829dc
commit b5e020daa2

View file

@ -621,6 +621,9 @@ _do_report_synthesis (GstValidateRunner * runner)
gpointer key, value;
GList *criticals = NULL;
/* Take the lock so the hash table won't be modified while we are iterating
* over it */
GST_VALIDATE_RUNNER_LOCK (runner);
g_hash_table_iter_init (&iter, runner->priv->reports_by_type);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GstValidateReport *report;
@ -647,6 +650,7 @@ _do_report_synthesis (GstValidateRunner * runner)
gst_validate_report_print_description (report);
gst_validate_printf (NULL, "\n");
}
GST_VALIDATE_RUNNER_UNLOCK (runner);
return criticals;
}