Caused by trying to set the account on the blank split. The blank split
was present because the method used to clear the split list for the
receiving transaction in gnc_float_txn_to_txn_swap_accounts only removed
splits that belong to the transaction, and the blank split doesn't.
Adds new function xaccTransClearSplits to do a more thorough job.
Also improve the documentation for xaccSplitDestroy to better explain when
a transaction will be destroyed if it empties the split list.
# Please enter the commit message for your
changes. Lines starting
- Balancing lots always involves splits in the same account. So
the relevant number to use in the calculations is the split
amount, not the split value.
- Additionally don't assume transactions are single-currency.
So if amounts change, recalculate the associated values
based on deduced exchange rates.
- Finally if the lot balancing resulted in a split to be broken up
into two splits use conservative calculations for the new
splits' values to avoid introducing imbalances due to
rounding errors.
For wrong value type when retrieving a value from the SQL results row.
Profiling showed that most of the SQL load time was spent in handling
these exceptions, and using std::optional instead produced a > 11x
speedup (10 seconds vs. 115 seconds) when loading a large file.
Add new test files that are written with the latest version of GnuCash.
Test loading them, saving to compressed files, loading those compressed
files and writing to an uncompressed file. At every stage check it matches
the canonical version.
The conditions being containing a split from a voided transaction.
Instead of trying to destroy zero-value splits (doomed to fail in
that instance and generally rude otherwise) just remove them from
the lot list.
==88804== 8 bytes in 1 blocks are definitely lost in loss record 12 of 479
==88804== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88804== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88804== by 0x10B5D8: get_random_string_without (test-stuff.c:312)
==88804== by 0x10B655: get_random_string (test-stuff.c:333)
==88804== by 0x10AA92: test_string_fcn (test-vendor.c:138)
==88804== by 0x10A76B: test_vendor (test-vendor.c:88)
==88804== by 0x10AD5A: main (test-vendor.c:246)
+ 3 more
==88779== 8 bytes in 1 blocks are definitely lost in loss record 9 of 461
==88779== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88779== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88779== by 0x10B871: get_random_string_without (test-stuff.c:312)
==88779== by 0x10B8EE: get_random_string (test-stuff.c:333)
==88779== by 0x10AB9F: test_string_fcn (test-job.c:157)
==88779== by 0x10A7B1: test_job (test-job.c:87)
==88779== by 0x10AFF3: main (test-job.c:262)
+ 3 more
==88366== 8 bytes in 1 blocks are definitely lost in loss record 11 of 474
==88366== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88366== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88366== by 0x10B7E9: get_random_string_without (test-stuff.c:312)
==88366== by 0x10B866: get_random_string (test-stuff.c:333)
==88366== by 0x10AB64: test_string_fcn (test-employee.c:140)
==88366== by 0x10A7C1: test_employee (test-employee.c:87)
==88366== by 0x10AF6B: main (test-employee.c:246)
+ 4 more
==88327== 8 bytes in 1 blocks are definitely lost in loss record 13 of 667
==88327== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88327== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88327== by 0x10B890: get_random_string_without (test-stuff.c:312)
==88327== by 0x10B90D: get_random_string (test-stuff.c:333)
==88327== by 0x10AC7A: test_string_fcn (test-customer.c:146)
==88327== by 0x10A82E: test_customer (test-customer.c:79)
==88327== by 0x10B012: main (test-customer.c:229)
+ 3 more
==88718== 8 bytes in 1 blocks are definitely lost in loss record 21 of 1,880
==88718== at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88718== by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88718== by 0x11D6B9: get_random_string_without (test-stuff.c:312)
==88718== by 0x11D736: get_random_string (test-stuff.c:333)
==88718== by 0x116A91: test_commodity() (test-commodities.cpp:60)
==88718== by 0x117355: main (test-commodities.cpp:196)
+ 5 more