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:
Geert Janssens 2018-04-17 23:03:31 +02:00
parent 51d1bc775d
commit 06db9bcf2b

View File

@ -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;
}