gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Mon Sep 11 20:44:05 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/16c9957c (commit)
via https://github.com/Gnucash/gnucash/commit/17ebb8a1 (commit)
from https://github.com/Gnucash/gnucash/commit/991f3d3a (commit)
commit 16c9957cac7b2ca2fe4b2b4a25c92878fcd4067b
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Sep 11 17:40:48 2023 -0700
Bug 798925 - Python bindings: "invalid unclassed pointer...
in cast to 'QofInstance'".
The list ended up with two entries of payment_lot resulting in a
dangling reference when one of them was freed.
diff --git a/libgnucash/engine/gncOwner.c b/libgnucash/engine/gncOwner.c
index 9e57d1130d..6441f5fbc1 100644
--- a/libgnucash/engine/gncOwner.c
+++ b/libgnucash/engine/gncOwner.c
@@ -1415,6 +1415,12 @@ gncOwnerApplyPaymentSecs (const GncOwner *owner, Transaction **preset_txn,
|| (!xfer_acc && !gnc_numeric_zero_p (amount)) ) return;
g_return_if_fail (owner->owner.undefined);
+ if (lots)
+ selected_lots = lots;
+ else if (auto_pay)
+ selected_lots = xaccAccountFindOpenLots (posted_acc, gncOwnerLotMatchOwnerFunc,
+ (gpointer)owner, NULL);
+
/* If there's a real amount to transfer create a lot for this payment */
if (!gnc_numeric_zero_p (amount))
payment_lot = gncOwnerCreatePaymentLotSecs (owner, preset_txn,
@@ -1422,18 +1428,14 @@ gncOwnerApplyPaymentSecs (const GncOwner *owner, Transaction **preset_txn,
amount, exch, date, memo,
num);
- if (lots)
- selected_lots = lots;
- else if (auto_pay)
- selected_lots = xaccAccountFindOpenLots (posted_acc, gncOwnerLotMatchOwnerFunc,
- (gpointer)owner, NULL);
-
- /* And link the selected lots and the payment lot together as well as possible.
- * If the payment was bigger than the selected documents/overpayments, only
- * part of the payment will be used. Similarly if more documents were selected
- * than the payment value set, not all documents will be marked as paid. */
+ /* And link the selected lots and the payment lot together as well
+ * as possible. If the payment was bigger than the selected
+ * documents/overpayments, only part of the payment will be
+ * used. Similarly if more documents were selected than the
+ * payment value set, not all documents will be marked as paid. */
if (payment_lot)
selected_lots = g_list_prepend (selected_lots, payment_lot);
+
gncOwnerAutoApplyPaymentsWithLots (owner, selected_lots);
g_list_free (selected_lots);
}
commit 17ebb8a1d2563c93fd585debcdd5360f0d311784
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Sep 11 17:39:02 2023 -0700
[simple-business-create.py] Overwrite an existing file instead of crashing.
diff --git a/bindings/python/example_scripts/simple_business_create.py b/bindings/python/example_scripts/simple_business_create.py
index 029a4f5300..01a38cbc7a 100644
--- a/bindings/python/example_scripts/simple_business_create.py
+++ b/bindings/python/example_scripts/simple_business_create.py
@@ -70,7 +70,7 @@ if len(argv) < 2:
try:
- s = Session(argv[1], SessionOpenMode.SESSION_NEW_STORE)
+ s = Session(argv[1], SessionOpenMode.SESSION_NEW_OVERWRITE)
book = s.book
root = book.get_root_account()
Summary of changes:
.../example_scripts/simple_business_create.py | 2 +-
libgnucash/engine/gncOwner.c | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
More information about the gnucash-changes
mailing list