[devhelp] DhSettings: set singleton to NULL in finalize() only if == object



commit 56c960a3fdf52aecb568487c9fc3c92d815fc403
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon May 1 12:53:09 2017 +0200

    DhSettings: set singleton to NULL in finalize() only if == object
    
    In theory several DhSettings instances can be created with
    dh_settings_get_type().

 src/dh-settings.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/dh-settings.c b/src/dh-settings.c
index 467894b..2404169 100644
--- a/src/dh-settings.c
+++ b/src/dh-settings.c
@@ -71,7 +71,8 @@ dh_settings_dispose (GObject *object)
 static void
 dh_settings_finalize (GObject *object)
 {
-        singleton = NULL;
+        if (singleton == DH_SETTINGS (object))
+                singleton = NULL;
 
         G_OBJECT_CLASS (dh_settings_parent_class)->finalize (object);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]