validate: scenario: Handle the fact that structs field names don't have a static lifetime anymore

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7453>
This commit is contained in:
Thibault Saunier 2024-09-04 17:16:09 -04:00 committed by GStreamer Marge Bot
parent ec11c337c3
commit 9f410a8714
3 changed files with 8 additions and 5 deletions

View file

@ -94,7 +94,7 @@ Only access it from the default main context.</doc>
<type name="gint" c:type="gint"/>
</field>
<field name="rangename" readable="0" private="1">
<type name="utf8" c:type="const gchar*"/>
<type name="utf8" c:type="gchar*"/>
</field>
<field name="priv" readable="0" private="1">
<type name="ActionPrivate" c:type="GstValidateActionPrivate*"/>

View file

@ -453,7 +453,8 @@ _action_copy (GstValidateAction * act)
g_strdup (GST_VALIDATE_ACTION_FILENAME (act));
GST_VALIDATE_ACTION_DEBUG (copy) = g_strdup (GST_VALIDATE_ACTION_DEBUG (act));
GST_VALIDATE_ACTION_N_REPEATS (copy) = GST_VALIDATE_ACTION_N_REPEATS (act);
GST_VALIDATE_ACTION_RANGE_NAME (copy) = GST_VALIDATE_ACTION_RANGE_NAME (act);
GST_VALIDATE_ACTION_RANGE_NAME (copy) =
g_strdup (GST_VALIDATE_ACTION_RANGE_NAME (act));
if (act->priv->it_value.g_type != 0) {
g_value_init (&copy->priv->it_value, G_VALUE_TYPE (&act->priv->it_value));
@ -504,6 +505,7 @@ _action_free (GstValidateAction * action)
g_free (GST_VALIDATE_ACTION_FILENAME (action));
g_free (GST_VALIDATE_ACTION_DEBUG (action));
g_free (action->rangename);
g_free (action->priv);
g_free (action);
}
@ -2683,7 +2685,7 @@ _foreach_find_iterator (GQuark field_id, GValue * value,
return FALSE;
}
GST_VALIDATE_ACTION_RANGE_NAME (action) = field;
GST_VALIDATE_ACTION_RANGE_NAME (action) = g_strdup (field);
return TRUE;
}
@ -4683,7 +4685,7 @@ gst_validate_create_subaction (GstValidateScenario * scenario,
"Unknown action type: '%s'", gst_structure_get_name (nstruct));
subaction = gst_validate_action_new (scenario, action_type, nstruct, FALSE);
GST_VALIDATE_ACTION_RANGE_NAME (subaction) =
GST_VALIDATE_ACTION_RANGE_NAME (action);
g_strdup (GST_VALIDATE_ACTION_RANGE_NAME (action));
GST_VALIDATE_ACTION_FILENAME (subaction) =
g_strdup (GST_VALIDATE_ACTION_FILENAME (action));
GST_VALIDATE_ACTION_DEBUG (subaction) =
@ -4716,6 +4718,7 @@ gst_validate_foreach_prepare (GstValidateAction * action)
_update_well_known_vars (scenario);
gst_validate_action_setup_repeat (scenario, action);
g_free (GST_VALIDATE_ACTION_RANGE_NAME (action));
GST_VALIDATE_ACTION_RANGE_NAME (action) = NULL;
gst_structure_foreach (action->structure,
(GstStructureForeachFunc) _foreach_find_iterator, action);

View file

@ -152,7 +152,7 @@ struct _GstValidateAction
gchar *filename;
gchar *debug;
gint n_repeats;
const gchar *rangename;
gchar *rangename;
GstValidateActionPrivate *priv;