Merge branch 'gsettings_closure' into 'main'

Incorrect output parameter handling in closure helper of g_settings_bind_with_mapping_closures

See merge request GNOME/glib!4667
This commit is contained in:
Philip Withnall
2025-06-19 12:32:26 +00:00
2 changed files with 11 additions and 0 deletions

View File

@@ -3161,6 +3161,14 @@ bind_with_mapping_invoke_get (GValue *value,
g_closure_invoke (data->get_mapping_closure, &out, 2, params, /* hint = */ NULL);
retval = g_value_get_boolean (&out);
if (retval)
{
const GValue *out_value = g_value_get_boxed (&params[0]);
g_assert (out_value != NULL);
g_value_copy (out_value, value);
}
g_value_unset (&out);
g_value_unset (&params[0]);

View File

@@ -1827,6 +1827,7 @@ test_bind_with_mapping_closures_parameters (void)
GSettings *settings;
GClosure *get;
GClosure *set;
gboolean val;
BindWithMappingData data = { FALSE, FALSE, FALSE, FALSE };
settings = g_settings_new ("org.gtk.test.binding");
@@ -1843,6 +1844,8 @@ test_bind_with_mapping_closures_parameters (void)
g_assert_true (data.get_called);
g_assert_false (data.set_called);
g_object_get (obj, "bool", &val, NULL);
g_assert_true (val);
data.get_called = FALSE;
g_object_set (obj, "bool", FALSE, NULL);