gnucash stable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Wed Apr 22 14:31:48 EDT 2026


Updated	 via  https://github.com/Gnucash/gnucash/commit/bdbc08e0 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d4c6101c (commit)
	from  https://github.com/Gnucash/gnucash/commit/6eee5402 (commit)



commit bdbc08e0abaf1cbd88a34145f933ed266c8051db
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Apr 22 11:28:31 2026 -0700

    Python Bindings: Destroy the QofSession in the Python Session dtor.
    
    Failing to do so can leave a DBI database locked, see
    https://github.com/Gnucash/gnucash/pull/2203

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index 61fff6e6b0..563ceee0d8 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -372,6 +372,7 @@ class Session(GnuCashCoreClass):
         if not exc_type:
             self.save()
         self.end()
+        self.destroy()
 
     def raise_backend_errors(self, called_function="qof_session function"):
         """Raises a GnuCashBackendException if there are outstanding

commit d4c6101c6c9c284503086f9603704ac80320e9d2
Author: John Ralls <jralls at ceridwen.us>
Date:   Wed Apr 22 11:24:18 2026 -0700

    Return immediately from qof_book_destroy if hash_of_collections is null.
    
    If qof_book_destroy is called on a QofBook* freshly created with
    qof_book_new (usually because it was used to create a session that now
    must be destroyed) it would try to empty the non-existent hash tables,
    crashing.

diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index 07adcc33e8..399309827e 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -332,7 +332,7 @@ qof_book_destroy (QofBook *book)
 {
     GHashTable* cols;
 
-    if (!book) return;
+    if (!book || !book->hash_of_collections) return;
     ENTER ("book=%p", book);
 
     book->shutting_down = TRUE;



Summary of changes:
 bindings/python/gnucash_core.py | 1 +
 libgnucash/engine/qofbook.cpp   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list