From 8d6f748aca103095e8451a88d1b59ea410bceaf6 Mon Sep 17 00:00:00 2001 From: Sherlock <119709043+agwekixj@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:34:14 -0700 Subject: [PATCH 1/2] Bug 799281 - Deleting a transaction may trigger a crash Update qof_collection_lookup_entity() to prevent returning instances marked to be destroyed. --- libgnucash/engine/qofid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libgnucash/engine/qofid.cpp b/libgnucash/engine/qofid.cpp index d48e55f9e7c..7d7f727abb1 100644 --- a/libgnucash/engine/qofid.cpp +++ b/libgnucash/engine/qofid.cpp @@ -216,6 +216,7 @@ qof_collection_lookup_entity (const QofCollection *col, const GncGUID * guid) if (guid == NULL) return NULL; ent = static_cast(g_hash_table_lookup (col->hash_of_entities, guid)); + if (qof_instance_get_destroying(ent)) return NULL; return ent; } From f0d45de642e4691b45a18e4f3919c9b774cd79ae Mon Sep 17 00:00:00 2001 From: Sherlock <119709043+agwekixj@users.noreply.github.com> Date: Fri, 12 Apr 2024 15:52:39 -0700 Subject: [PATCH 2/2] Resolve test assert. --- libgnucash/engine/qofid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgnucash/engine/qofid.cpp b/libgnucash/engine/qofid.cpp index 7d7f727abb1..cd23c46365d 100644 --- a/libgnucash/engine/qofid.cpp +++ b/libgnucash/engine/qofid.cpp @@ -216,7 +216,7 @@ qof_collection_lookup_entity (const QofCollection *col, const GncGUID * guid) if (guid == NULL) return NULL; ent = static_cast(g_hash_table_lookup (col->hash_of_entities, guid)); - if (qof_instance_get_destroying(ent)) return NULL; + if (ent != NULL && qof_instance_get_destroying(ent)) return NULL; return ent; }