From 63abca2963c80a723b42e7459b0e07798175e4f1 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 2 Feb 2018 11:13:23 +0100 Subject: [PATCH] gsettings: Add missing changed() call to delayed settings backend When resetting a key in the delayed settings backend, g_settings_backend_changed() was not called to notify the backend of the change. Signed-off-by: Philip Withnall Fixes: #1309 --- gio/gdelayedsettingsbackend.c | 2 ++ gio/tests/gsettings.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gio/gdelayedsettingsbackend.c b/gio/gdelayedsettingsbackend.c index e41393f8e..9ba3c5b64 100644 --- a/gio/gdelayedsettingsbackend.c +++ b/gio/gdelayedsettingsbackend.c @@ -204,6 +204,8 @@ g_delayed_settings_backend_reset (GSettingsBackend *backend, g_tree_insert (delayed->priv->delayed, g_strdup (key), NULL); g_mutex_unlock (&delayed->priv->lock); + g_settings_backend_changed (backend, key, origin_tag); + if (was_empty) g_delayed_settings_backend_notify_unapplied (delayed); } diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c index 77905ec7a..baadca8f5 100644 --- a/gio/tests/gsettings.c +++ b/gio/tests/gsettings.c @@ -509,6 +509,24 @@ test_delay_apply (void) g_assert_true (changed_cb_called); g_assert_false (changed_cb_called2); + /* Try resetting the key and ensure a notification is emitted on the delayed #GSettings object. */ + changed_cb_called = FALSE; + changed_cb_called2 = FALSE; + + g_settings_reset (settings, "greeting"); + + g_assert_true (changed_cb_called); + g_assert_false (changed_cb_called2); + + /* Locally change the greeting again. */ + changed_cb_called = FALSE; + changed_cb_called2 = FALSE; + + g_settings_set (settings, "greeting", "s", "greetings from test_delay_apply"); + + g_assert_true (changed_cb_called); + g_assert_false (changed_cb_called2); + writable = g_settings_is_writable (settings, "greeting"); g_assert_true (writable);