1
0
Fork 0

clutter: Safely transform paths to strings and vice versa

GValues containing objects and strings can be set to NULL, which means
the transformation functions from ClutterPath to string and vice versa
must be NULL-safe.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2625
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2929>
This commit is contained in:
Emmanuele Bassi 2023-03-20 21:42:11 +00:00 committed by Marge Bot
parent 4f47ba26be
commit bc9cad5124

View file

@ -211,19 +211,26 @@ static void
clutter_value_transform_path_string (const GValue *src,
GValue *dest)
{
gchar *string = clutter_path_get_description (src->data[0].v_pointer);
if (src->data[0].v_pointer != NULL)
{
gchar *string = clutter_path_get_description (src->data[0].v_pointer);
g_value_take_string (dest, string);
g_value_take_string (dest, string);
}
}
static void
clutter_value_transform_string_path (const GValue *src,
GValue *dest)
{
ClutterPath *new_path;
const char *str;
new_path = clutter_path_new_with_description (g_value_get_string (src));
g_value_take_object (dest, new_path);
str = g_value_get_string (src);
if (str != NULL)
{
ClutterPath *new_path = clutter_path_new_with_description (str);
g_value_take_object (dest, new_path);
}
}
static void