From 1339c1161fcd8bd76b0d8a57ea5a3946cddfb9f6 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sun, 13 Nov 2016 17:26:43 +0100 Subject: [PATCH] Fix make check after commit 673888dee7c - 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 --- src/engine/gnc-lot.c | 2 +- src/engine/test/utest-Account.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/engine/gnc-lot.c b/src/engine/gnc-lot.c index 3afb296f55..1c90bf52ff 100644 --- a/src/engine/gnc-lot.c +++ b/src/engine/gnc-lot.c @@ -227,7 +227,7 @@ gnc_lot_free(GNCLot* lot) } g_list_free (priv->splits); - if (priv->account) + if (priv->account && !qof_instance_get_destroying(priv->account)) xaccAccountRemoveLot (priv->account, lot); priv->account = NULL; diff --git a/src/engine/test/utest-Account.c b/src/engine/test/utest-Account.c index f0f2aba8a1..e94760e5c7 100644 --- a/src/engine/test/utest-Account.c +++ b/src/engine/test/utest-Account.c @@ -1274,15 +1274,11 @@ test_xaccAccountInsertRemoveLot (Fixture *fixture, gconstpointer pData) g_assert_cmpuint (g_list_length (p_priv->lots), == , 1); g_assert (gnc_lot_get_account (lot) == parent); gnc_lot_destroy (lot); - /* Destroying the lot should remove it from the account; Not Happening. */ - g_assert_cmpuint (g_list_length (p_priv->lots), != , 0); + /* Destroying the lot should remove it from the account. */ + g_assert_cmpuint (g_list_length (p_priv->lots), == , 0); test_signal_assert_hits (sig1, 3); - /* We get a modify only on the insert, since there is no remove when - * the lot is destroyed. */ - 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_assert_hits (sig3, 2); + test_signal_assert_hits (sig4, 4); test_signal_free (sig1); test_signal_free (sig2); test_signal_free (sig3);