gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Mon Oct 2 15:38:53 EDT 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/d2fe6132 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a389e0a3 (commit)
	from  https://github.com/Gnucash/gnucash/commit/fc0e80bb (commit)



commit d2fe61326dedf8e78e53eff5868392e0e5168482
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Oct 2 12:21:33 2023 -0700

    IWYU and gnc-gsettings.h isn't used in these files.

diff --git a/gnucash/gnucash-core-app.cpp b/gnucash/gnucash-core-app.cpp
index c8d84afaae..08ae1fc9cb 100644
--- a/gnucash/gnucash-core-app.cpp
+++ b/gnucash/gnucash-core-app.cpp
@@ -40,7 +40,6 @@
 #include <gnc-locale-utils.h>
 #include <gnc-path.h>
 #include <gnc-prefs.h>
-#include <gnc-gsettings.h>
 #include <gnc-version.h>
 #include "gnucash-locale-platform.h"
 
diff --git a/gnucash/gnucash.cpp b/gnucash/gnucash.cpp
index 1110b05baa..4cb4b2d3e0 100644
--- a/gnucash/gnucash.cpp
+++ b/gnucash/gnucash.cpp
@@ -39,7 +39,6 @@
 #include <gnc-file.h>
 #include <gnc-filepath-utils.h>
 #include <gnc-gnome-utils.h>
-#include <gnc-gsettings.h>
 #include <gnc-hooks.h>
 #include <gnc-module.h>
 #include <gnc-path.h>

commit a389e0a32e9c835218341264e49477e0c51fb333
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Oct 2 12:20:26 2023 -0700

    Bug 799092 - GnuCash 5.4 leaves background process running on exit
    
    Clear the schema_hash at app shutdown via gnc_prefs_remove_registered
    and make that function available to the Python bindings so that
    python programs can do so too.

diff --git a/bindings/app-utils.i b/bindings/app-utils.i
index 96430c3034..6ba39a9573 100644
--- a/bindings/app-utils.i
+++ b/bindings/app-utils.i
@@ -57,6 +57,7 @@ PyObject* SWIG_init (void);
 %import "base-typemaps.i"
 
 void gnc_prefs_init();
+void gnc_prefs_remove_registered();
 
 QofBook * gnc_get_current_book (void);
 QofSession * gnc_get_current_session (void);
diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp
index 668eb5928c..fcc60ed248 100644
--- a/libgnucash/app-utils/gnc-gsettings.cpp
+++ b/libgnucash/app-utils/gnc-gsettings.cpp
@@ -522,9 +522,7 @@ void gnc_gsettings_load_backend (void)
     if (g_strcmp0 (g_getenv ("GNC_UNINSTALLED"), "1") == 0)
         return;
 
-    if (prefsbackend)
-        g_free (prefsbackend);
-
+    g_free (prefsbackend);
     prefsbackend = g_new0 (PrefsBackend, 1);
 
     prefsbackend->register_cb = gnc_gsettings_register_cb;
@@ -560,6 +558,12 @@ void gnc_gsettings_load_backend (void)
     LEAVE("Prefsbackend bind = %p", prefsbackend->bind);
 }
 
+void
+gnc_gsettings_shutdown (void)
+{
+    schema_hash.clear();
+    g_free (prefsbackend);
+}
 
 
 static GVariant *
diff --git a/libgnucash/app-utils/gnc-gsettings.h b/libgnucash/app-utils/gnc-gsettings.h
index bbd013a2b8..9c9059897a 100644
--- a/libgnucash/app-utils/gnc-gsettings.h
+++ b/libgnucash/app-utils/gnc-gsettings.h
@@ -570,6 +570,10 @@ void gnc_gsettings_reset_schema (const gchar *schema);
  */
 void gnc_gsettings_load_backend (void);
 
+/** Free the GSettings resources.
+ */
+void gnc_gsettings_shutdown (void);
+
 /** Check whether we need to adjust the user settings
  * to a newer version.
  *
diff --git a/libgnucash/app-utils/gnc-prefs-utils.c b/libgnucash/app-utils/gnc-prefs-utils.c
index 90fd918d2b..eab9869026 100644
--- a/libgnucash/app-utils/gnc-prefs-utils.c
+++ b/libgnucash/app-utils/gnc-prefs-utils.c
@@ -139,4 +139,5 @@ gnc_prefs_remove_registered (void)
                            file_retain_type_changed_cb, NULL);
     gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_FILE_COMPRESSION,
                            file_compression_changed_cb, NULL);
+    gnc_gsettings_shutdown ();
 }



Summary of changes:
 bindings/app-utils.i                   |  1 +
 gnucash/gnucash-core-app.cpp           |  1 -
 gnucash/gnucash.cpp                    |  1 -
 libgnucash/app-utils/gnc-gsettings.cpp | 10 +++++++---
 libgnucash/app-utils/gnc-gsettings.h   |  4 ++++
 libgnucash/app-utils/gnc-prefs-utils.c |  1 +
 6 files changed, 13 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list