mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix crash/invalid memory access when unposting an invoice.
This is triggered when glib is configured with G_SLICE=always-malloc git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22104 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ec8fc423ba
commit
4f603c718d
@ -1532,7 +1532,10 @@ gncInvoiceUnpost (GncInvoice *invoice, gboolean reset_tax_tables)
|
||||
* You could consider these transactions to be links between lots as well, but
|
||||
* to avoid some unexpected behavior, these will not be altered here.
|
||||
*/
|
||||
lot_split_list = gnc_lot_get_split_list (lot);
|
||||
|
||||
// Note: make a copy of the lot list here, when splits are deleted from the lot,
|
||||
// the original list may be destroyed by the lot code.
|
||||
lot_split_list = g_list_copy (gnc_lot_get_split_list (lot));
|
||||
for (lot_split_iter = lot_split_list; lot_split_iter; lot_split_iter = lot_split_iter->next)
|
||||
{
|
||||
Split *split = lot_split_iter->data;
|
||||
@ -1566,7 +1569,6 @@ gncInvoiceUnpost (GncInvoice *invoice, gboolean reset_tax_tables)
|
||||
xaccTransBeginEdit (other_txn);
|
||||
xaccTransDestroy (other_txn);
|
||||
xaccTransCommitEdit (other_txn);
|
||||
g_assert(lot_split_list == gnc_lot_get_split_list (lot));
|
||||
|
||||
/* Re-balance the saved lots as well as is possible */
|
||||
gncOwnerAutoApplyPaymentsWithLots (&invoice->owner, lot_list);
|
||||
@ -1585,6 +1587,7 @@ gncInvoiceUnpost (GncInvoice *invoice, gboolean reset_tax_tables)
|
||||
qof_event_gen (QOF_INSTANCE(other_invoice), QOF_EVENT_MODIFY, NULL);
|
||||
}
|
||||
}
|
||||
g_list_free (lot_split_list);
|
||||
|
||||
/* If the lot has no splits, then destroy it */
|
||||
if (!gnc_lot_count_splits (lot))
|
||||
|
Loading…
Reference in New Issue
Block a user