mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix crash when loading sql book with posted transactions
This crash started to appear as of commit 80dbb9940b
because the sequence
of split loading has changed as a result of the query optimizations.
Invoice transactions get loaded before the general transaction loading happens.
However because of this, when an invoice transaction was encountered again
during general transaction loading, it was (correctly) not created again
AND (incorrectly) not opened for subsequent editing. This caused
an assert to fail when the splits for this transaction are loaded
shortly afterwards. The solution is simply to ensure all transactions
are opened for editing during the general transaction loading call.
This commit is contained in:
parent
51d1bc775d
commit
06db9bcf2b
@ -293,9 +293,11 @@ load_single_tx (GncSqlBackend* sql_be, GncSqlRow& row)
|
||||
tx_guid = *guid;
|
||||
|
||||
// Don't overwrite the transaction if it's already been loaded (and possibly modified).
|
||||
// However increase the edit level, it may be modified while loading its splits
|
||||
pTx = xaccTransLookup (&tx_guid, sql_be->book());
|
||||
if (pTx != NULL)
|
||||
{
|
||||
xaccTransBeginEdit (pTx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user