gnucash maint: Fix make check after commit 673888dee7c

Geert Janssens gjanssens at code.gnucash.org
Sun Nov 13 11:26:54 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/1339c116 (commit)
	from  https://github.com/Gnucash/gnucash/commit/ecb43e7d (commit)



commit 1339c1161fcd8bd76b0d8a57ea5a3946cddfb9f6
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Sun Nov 13 17:26:43 2016 +0100

    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

diff --git a/src/engine/gnc-lot.c b/src/engine/gnc-lot.c
index 3afb296..1c90bf5 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 f0f2aba..e94760e 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);



Summary of changes:
 src/engine/gnc-lot.c            |  2 +-
 src/engine/test/utest-Account.c | 12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)



More information about the gnucash-changes mailing list