Fix make check after commit 673888dee7

- Update the lot list of the lot's account only when the account itself is not being destroyed
- Fix the test cases to accept the new (improved) lot destruction handling
This commit is contained in:
Geert Janssens 2016-11-13 17:26:43 +01:00
parent ecb43e7d72
commit 1339c1161f
2 changed files with 5 additions and 9 deletions

View File

@ -227,7 +227,7 @@ gnc_lot_free(GNCLot* lot)
} }
g_list_free (priv->splits); g_list_free (priv->splits);
if (priv->account) if (priv->account && !qof_instance_get_destroying(priv->account))
xaccAccountRemoveLot (priv->account, lot); xaccAccountRemoveLot (priv->account, lot);
priv->account = NULL; priv->account = NULL;

View File

@ -1274,15 +1274,11 @@ test_xaccAccountInsertRemoveLot (Fixture *fixture, gconstpointer pData)
g_assert_cmpuint (g_list_length (p_priv->lots), == , 1); g_assert_cmpuint (g_list_length (p_priv->lots), == , 1);
g_assert (gnc_lot_get_account (lot) == parent); g_assert (gnc_lot_get_account (lot) == parent);
gnc_lot_destroy (lot); gnc_lot_destroy (lot);
/* Destroying the lot should remove it from the account; Not Happening. */ /* Destroying the lot should remove it from the account. */
g_assert_cmpuint (g_list_length (p_priv->lots), != , 0); g_assert_cmpuint (g_list_length (p_priv->lots), == , 0);
test_signal_assert_hits (sig1, 3); test_signal_assert_hits (sig1, 3);
/* We get a modify only on the insert, since there is no remove when test_signal_assert_hits (sig3, 2);
* the lot is destroyed. */ test_signal_assert_hits (sig4, 4);
test_signal_assert_hits (sig4, 3);
/* Same thing: There should be a "removed" signal on the lot, but
* since it isn't removed, no signal. */
test_signal_assert_hits (sig3, 1);
test_signal_free (sig1); test_signal_free (sig1);
test_signal_free (sig2); test_signal_free (sig2);
test_signal_free (sig3); test_signal_free (sig3);