Merge branch 'maint'

This commit is contained in:
John Ralls 2023-03-14 10:43:45 -07:00
commit 83829e6513
3 changed files with 12 additions and 1 deletions

View File

@ -1332,6 +1332,12 @@ xaccFreeAccount (Account *acc)
priv = GET_PRIVATE(acc);
qof_event_gen (&acc->inst, QOF_EVENT_DESTROY, NULL);
/* Otherwise the lists below get munged while we're iterating
* them, possibly crashing.
*/
if (!qof_instance_get_destroying (acc))
qof_instance_set_destroying(acc, TRUE);
if (priv->children)
{
PERR (" instead of calling xaccFreeAccount(), please call\n"

View File

@ -2902,7 +2902,8 @@ static void
xaccTransScrubGainsDate (Transaction *trans)
{
SplitList *node;
for (node = trans->splits; node; node = node->next)
SplitList *splits_copy = g_list_copy(trans->splits);
for (node = splits_copy; node; node = node->next)
{
Split *s = node->data;
@ -2921,6 +2922,7 @@ xaccTransScrubGainsDate (Transaction *trans)
FOR_EACH_SPLIT(trans, s->gains &= ~GAINS_STATUS_DATE_DIRTY);
}
}
g_list_free(splits_copy);
}
/* ============================================================== */

View File

@ -1415,6 +1415,9 @@ test_do_destroy (GainsFixture *fixture, gconstpointer pData)
g_object_ref (base->txn);
g_object_ref (fixture->gains_txn);
/* Protect against recursive calls to do_destroy from xaccTransCommitEdit */
xaccTransBeginEdit(base->txn);
base->func->do_destroy (base->txn);
g_assert_cmpint (test_signal_return_hits (sig), ==, 1);
g_assert (base->txn->description == NULL);