gsettings: Clarify that g_settings_get_child() inherits delay-apply

Previously, the delay-apply status of the parent `GSettings` object
would be partially inherited: `settings->priv->backend` in the child
`GSettings` object would point to a `GDelayedSettingsBackend`, but
`settings->priv->delayed` would be `NULL`.

The expectation from https://bugzilla.gnome.org/show_bug.cgi?id=720891
was that `get_child()` would fully inherit delay-apply status.

So, ensure that `settings->priv->delayed` is correctly set to point to
the delayed backend when constructing any `GSettings`. Update the tests
to work again (presumably the inverted test was an oversight in the
original changes).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2426
This commit is contained in:
Philip Withnall
2021-10-26 14:10:19 +01:00
parent 3db22ab8db
commit 0101ccba16
2 changed files with 21 additions and 2 deletions

View File

@@ -619,7 +619,7 @@ test_delay_child (void)
g_assert_nonnull (child);
g_object_get (child, "delay-apply", &delay, NULL);
g_assert_false (delay);
g_assert_true (delay);
g_settings_get (child, "test-byte", "y", &byte);
g_assert_cmpuint (byte, ==, 36);
@@ -630,6 +630,11 @@ test_delay_child (void)
g_settings_get (base, "test-byte", "y", &byte);
g_assert_cmpuint (byte, ==, 36);
/* apply the child and the changes should be saved */
g_settings_apply (child);
g_settings_get (base, "test-byte", "y", &byte);
g_assert_cmpuint (byte, ==, 42);
g_object_unref (child);
g_object_unref (settings);
g_object_unref (base);