mirror of
https://github.com/brl/mutter.git
synced 2025-01-13 13:12:28 +00:00
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:
parent
4f47ba26be
commit
bc9cad5124
@ -211,19 +211,26 @@ static void
|
|||||||
clutter_value_transform_path_string (const GValue *src,
|
clutter_value_transform_path_string (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
|
if (src->data[0].v_pointer != NULL)
|
||||||
|
{
|
||||||
gchar *string = clutter_path_get_description (src->data[0].v_pointer);
|
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
|
static void
|
||||||
clutter_value_transform_string_path (const GValue *src,
|
clutter_value_transform_string_path (const GValue *src,
|
||||||
GValue *dest)
|
GValue *dest)
|
||||||
{
|
{
|
||||||
ClutterPath *new_path;
|
const char *str;
|
||||||
|
|
||||||
new_path = clutter_path_new_with_description (g_value_get_string (src));
|
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);
|
g_value_take_object (dest, new_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user