From 8b022a5595f7191f2110ebaa793c8143359e14be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 11 Sep 2017 11:26:03 +0800 Subject: [PATCH] monitor-config-store: Maybe force save configuration on tear down If there is a pending config file content replacement in progress on tear down, cancel it and save it synchronously to avoid any data loss. https://bugzilla.gnome.org/show_bug.cgi?id=787477 --- src/backends/meta-monitor-config-store.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backends/meta-monitor-config-store.c b/src/backends/meta-monitor-config-store.c index a33ef752d..d184b3d4b 100644 --- a/src/backends/meta-monitor-config-store.c +++ b/src/backends/meta-monitor-config-store.c @@ -1434,6 +1434,14 @@ meta_monitor_config_store_dispose (GObject *object) { MetaMonitorConfigStore *config_store = META_MONITOR_CONFIG_STORE (object); + if (config_store->save_cancellable) + { + g_cancellable_cancel (config_store->save_cancellable); + g_clear_object (&config_store->save_cancellable); + + meta_monitor_config_store_save_sync (config_store); + } + g_clear_pointer (&config_store->configs, g_hash_table_destroy); g_clear_object (&config_store->user_file);