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.
This commit is contained in:
John Ralls 2023-10-02 12:20:26 -07:00
parent fc0e80bbad
commit a389e0a32e
4 changed files with 13 additions and 3 deletions

View File

@ -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);

View File

@ -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 *

View File

@ -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.
*

View File

@ -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 ();
}