Commit Graph

2262 Commits

Author SHA1 Message Date
Christopher Lam
ab7ead39ca use icu::ListFormatter to combine a list strings into a string 2023-10-02 17:52:54 +08:00
Christopher Lam
d1b2368f4d Merge Yongun Seong's branch 'utest-gnc-pricedb-types' into stable #1784 2023-09-27 22:16:39 +08:00
Yongun Seong
0bd556c581
[utest-gnc-pricedb] fix test failure due to callback type mismatch 2023-09-25 15:38:06 +09:00
John Ralls
422fd0cab2 Fix misspelled/missing dist files. 2023-09-23 14:01:11 -07:00
John Ralls
776a430734 Bug 798904 - GnuCash on Windows opens a CMD window at startup.
Applied patch from bug report supplied by "Sherlock".
2023-09-22 13:21:11 -07:00
John Ralls
90b9142096 [DBI backend] Change DBI test URLs to environment variables.
From cmake configuration definitions.
2023-09-21 14:33:50 -07:00
Christopher Lam
550c43d13a Merge branch 'free-guid-string' into stable #1777 2023-09-20 07:29:16 +08:00
John Ralls
a49fd0bc09 [c++options] Correctly implement handling Fancy Date Format.
It's not a simple string.
2023-09-19 16:05:53 -07:00
Christopher Lam
8e21d3328f guid_to_string should be freed. 2023-09-19 20:31:11 +08:00
Christopher Lam
d21698f7cf [gnc-option-impl] don't leak char*
use the stack
2023-09-19 07:59:53 +08:00
Christopher Lam
55b9382ad9 [utest-gnc-backend-sql] properly clean up QofBook 2023-09-19 07:59:38 +08:00
Christopher Lam
01f27e9c53 [test-commodities] clean up commodities 2023-09-19 07:59:38 +08:00
Christopher Lam
fccf0b48c4 [utest-Account] g_free char* 2023-09-19 07:59:38 +08:00
Christopher Lam
c074b82224 [test-qofsession] plugs Account* leak 2023-09-17 08:37:09 +08:00
Christopher Lam
1ddee7dc3f [test-qofbook] plugs Account* leak 2023-09-17 08:37:04 +08:00
Christopher Lam
a81bc72fb1 [test-sx] plug some leaks 2023-09-16 08:42:42 +08:00
Christopher Lam
94211c2e57 [test-sx] plug some leaks 2023-09-16 08:42:40 +08:00
Christopher Lam
14622e7db6 [test-print-parse-amount] plug leaks 2023-09-16 05:46:46 +08:00
Christopher Lam
c44194606a [test-xml-pricedb] free a sixtp parser 2023-09-15 23:55:06 +08:00
Christopher Lam
34564ef6d0 [test-qofobject] plug some leaks 2023-09-15 23:34:43 +08:00
Christopher Lam
8277f4d559 [test-qofbook] plug leaks 2023-09-15 23:34:43 +08:00
Christopher Lam
0056e5f091 [gtest-import-map] plug leaks 2023-09-15 23:34:43 +08:00
Christopher Lam
235e24a055 [account.cpp] ~GncImapInfo = gnc_account_imap_info_destroy 2023-09-15 23:34:43 +08:00
Christopher Lam
db77fb81a5 [test-job] plug leaks 2023-09-15 23:34:43 +08:00
Christopher Lam
a8dffb8559 [gnc-date.cpp] don't alloc tm* unless GncDateTime() succeeds
because GncDateTime() may throw an exception, in which case time will
leak. mainly leaks in test suite.
2023-09-15 23:33:47 +08:00
Christopher Lam
5a03d9798c [gnc-sx-instance-model] g_free char* 2023-09-15 23:33:47 +08:00
John Ralls
16c9957cac Bug 798925 - Python bindings: "invalid unclassed pointer...
in cast to 'QofInstance'".

The list ended up with two entries of payment_lot resulting in a
dangling reference when one of them was freed.
2023-09-11 17:40:48 -07:00
John Ralls
89360252fb Bug 798983 - Empty Orphan account appears after entering transactions in 5.3
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
2023-09-08 15:08:44 -07:00
Christopher Lam
7ce4198c20 rename string_to_gnc_numeric to gnc_numeric_from_string 2023-08-29 08:45:20 +08:00
Christopher Lam
c45b9736ab [gnc-numeric.cpp] parse integer + fraction; e.g."10 1/4" == 10.25 2023-08-29 08:30:30 +08:00
Geert Janssens
e2f8233e1e Bug 798950 - Bug Report: Incorrect Currency Conversion and Provider Invoice Payment Recording
- 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.
2023-08-21 16:01:27 +02:00
Mike Alexander
3aa6e60f95 fix debugging output, no functional change. 2023-08-16 00:07:56 -04:00
Christopher Lam
f8546dc4da Fix compilation error from 5781f3445b 2023-08-11 23:35:10 +08:00
John Ralls
73dec63d1d Eliminate a frequent exception in guid_from_string
By not trying to construct a GUID from an empty string.
2023-08-10 14:05:10 -07:00
John Ralls
5781f3445b SQLBackend: Use std::optional return value instead of exceptions
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.
2023-08-10 14:05:10 -07:00
John Ralls
a5404f6607 Improve reporting when parse_quote throws an exception.
Add more detail to the error message and pass the right value to the
gnc_error_dialog so that the error is actually displayed to the user.
2023-08-08 15:41:16 -07:00
Christopher Lam
e91752dba2 [gnc-ui-util.c] plug GList* leak
because gnc_account_get_children should have been freed.
2023-08-08 19:59:54 +08:00
Christopher Lam
fc21c55a0b [gnc-pricedb.cpp] more glib g_list uses
* use g_list_find_custom where appropriate
* also g_list_free_full and g_list_foreach
2023-08-07 08:39:07 +08:00
Christopher Lam
d89544563d Revert "[gnc-pricedb.cpp] use std::pair instead of a struct for PriceTuple"
This reverts commit 2d730e38d5.
2023-08-05 11:02:57 +08:00
Christopher Lam
2d730e38d5 [gnc-pricedb.cpp] use std::pair instead of a struct for PriceTuple 2023-08-04 20:34:07 +08:00
Christopher Lam
6b741ddf32 [gnc-pricedb.cpp] use forloop instead of do..while and while
because they're scanning GLists, and forloop is tidier than while
2023-08-04 20:33:02 +08:00
John Ralls
4d46a8191d Merge Simon Arlott's 'test-xml-save' into stable. 2023-08-03 11:05:11 -07:00
Christopher Lam
79c0fe4724 [gnc-pricedb.cpp] convert hash_table_to_list to hash_table_to_vector 2023-08-03 00:34:30 +08:00
Christopher Lam
5e09b662a1 [utest-gnc-pricedb] test gnc_pricedb_foreach_price both stable and unstable 2023-08-03 00:33:52 +08:00
Christopher Lam
040ccb79b6 [gnc-pricedb.cpp] rewrite price_list_insert more efficiently
no need for PriceListIsDuplStruct
and shortcut "return true" if price is a duplicate
2023-08-02 23:23:00 +08:00
Christopher Lam
d6b49bbc89 [utest-gnc-pricedb.c] tests gnc_pricedb_price_list_insert
especially skipping adding duplicate price
2023-08-02 23:19:20 +08:00
Simon Arlott
35bee1382d
Test loading and saving XML files with and without compression
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.
2023-07-30 19:11:57 +01:00
John Ralls
dee01706eb Merge John Ralls's 'bug798958' into stable. 2023-07-28 12:10:22 -07:00
John Ralls
cbe765c6d9 Bug 798958 - gncScrubLotLinks will infinite loop in some conditions
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.
2023-07-27 14:46:55 -07:00
Christopher Lam
867867da53 Merge Richard Cohen branch 'fix-leaks-in-tests' into stable #1713 2023-07-24 13:09:55 +08:00
Christopher Lam
920f760dd8 Merge Richard Cohen branch 'fix-some-leaks-on-error-path' into stable #1714 2023-07-24 13:08:38 +08:00
Christopher Lam
cdc5b6a796 Merge Richard Cohen branch 'fix-test-leaks-from-get-random-string' into stable #1715 2023-07-24 13:07:40 +08:00
Christopher Lam
e841ceaaa1 [gnc-pricedb.cpp] convert to cpp 2023-07-23 15:19:43 +08:00
John Ralls
c5181180ad Fix GncOptionMultichoiceValue list tests
To conform to changes in 84eb084375.
2023-07-20 21:24:31 -07:00
Richard Cohen
a36844720d Valgrind: fix "definitely lost" memory from get_random_string() - test-vendor
==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
2023-07-20 15:23:09 +01:00
Richard Cohen
30b47d1669 Valgrind: fix "definitely lost" memory from get_random_string() - test-job
==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
2023-07-20 15:23:09 +01:00
Richard Cohen
49240e9b5a Valgrind: fix "definitely lost" memory from get_random_string() - test-employee
==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
2023-07-20 15:23:05 +01:00
Richard Cohen
2f0c045187 Valgrind: fix "definitely lost" memory from get_random_string() - test-customer
==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
2023-07-20 15:23:01 +01:00
Richard Cohen
394823a734 Valgrind: fix "definitely lost" memory from get_random_string() - test-commodities
==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
2023-07-20 15:22:56 +01:00
Richard Cohen
47f76fcf03 Valgrind: fix "definitely lost" memory from get_random_string() - test-address
==88262== 6 bytes in 1 blocks are definitely lost in loss record 5 of 2,117
==88262==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==88262==    by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==88262==    by 0x10B043: get_random_string_without (test-stuff.c:312)
==88262==    by 0x10B0C0: get_random_string (test-stuff.c:333)
==88262==    by 0x10A6E0: test_string_fcn (test-address.c:79)
==88262==    by 0x10A694: test_address (test-address.c:69)
==88262==    by 0x10A7C5: main (test-address.c:94)

+ 7 more
2023-07-20 15:22:52 +01:00
Richard Cohen
1943caee55 Fix memory leak on error path in text_to_dom_tree() 2023-07-19 10:29:06 +01:00
Richard Cohen
2640911901 Valgrind: fix "definitely lost/still reachable" memory in test - test-xml2-is-file
Valgrind uses "still reachable" because of the call to exit()

==87185== 94 bytes in 1 blocks are still reachable in loss record 193 of 241
==87185==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==87185==    by 0x15C234: main (test-xml2-is-file.cpp:42)
==87185==
2023-07-19 10:21:30 +01:00
Richard Cohen
d808fddc95 Valgrind: fix "definitely lost" memory in test - test-userdata-dir-invalid-home
==66427== 128 bytes in 1 blocks are definitely lost in loss record 22 of 25
==66427==    at 0x4843738: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==66427==    by 0x49B85EF: g_realloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==66427==    by 0x49D6EF1: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==66427==    by 0x49D6F6F: g_string_sized_new (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==66427==    by 0x499AB00: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==66427==    by 0x499B2D8: g_build_filename (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==66427==    by 0x10A498: main (test-userdata-dir-invalid-home.c:74)
==66427==
2023-07-19 10:21:30 +01:00
Richard Cohen
b7d278556f Valgrind: fix "definitely lost" memory in test - test-string-converters
==68902== 8 bytes in 1 blocks are definitely lost in loss record 7 of 251
==68902==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==68902==    by 0x5225948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==68902==    by 0x5240ED2: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==68902==    by 0x13135E: g_strdup_inline (gstrfuncs.h:321)
==68902==    by 0x13135E: dom_tree_to_text(_xmlNode*) (sixtp-dom-parsers.cpp:500)
==68902==    by 0x141758: test_bad_string() (test-string-converters.cpp:70)
==68902==    by 0x1417D8: main (test-string-converters.cpp:82)
==68902==
==68902== 93 bytes in 5 blocks are definitely lost in loss record 199 of 251
==68902==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==68902==    by 0x5225948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==68902==    by 0x5240ED2: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==68902==    by 0x13135E: g_strdup_inline (gstrfuncs.h:321)
==68902==    by 0x13135E: dom_tree_to_text(_xmlNode*) (sixtp-dom-parsers.cpp:500)
==68902==    by 0x14169B: test_string_converters() (test-string-converters.cpp:55)
==68902==    by 0x1417D3: main (test-string-converters.cpp:81)
==68902==
==68902== 260 (120 direct, 140 indirect) bytes in 1 blocks are definitely lost in loss record 242 of 251
==68902==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==68902==    by 0x48D5B84: xmlNewNode (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.14)
==68902==    by 0x133873: text_to_dom_tree(char const*, char const*) (sixtp-dom-generators.cpp:53)
==68902==    by 0x141748: test_bad_string() (test-string-converters.cpp:68)
==68902==    by 0x1417D8: main (test-string-converters.cpp:82)
==68902==
==68902== 1,353 (600 direct, 753 indirect) bytes in 5 blocks are definitely lost in loss record 248 of 251
==68902==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==68902==    by 0x48D5B84: xmlNewNode (in /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.14)
==68902==    by 0x133873: text_to_dom_tree(char const*, char const*) (sixtp-dom-generators.cpp:53)
==68902==    by 0x14168B: test_string_converters() (test-string-converters.cpp:54)
==68902==    by 0x1417D3: main (test-string-converters.cpp:81)
==68902==
2023-07-19 10:21:30 +01:00
Richard Cohen
378dc40585 Valgrind: fix "definitely lost" memory in test - test-resolve-file-path
==91379== 19 bytes in 1 blocks are definitely lost in loss record 2 of 9
==91379==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==91379==    by 0x48D1948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==91379==    by 0x48ED5B0: g_strconcat (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==91379==    by 0x48B845F: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==91379==    by 0x48B869E: g_dir_make_tmp (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==91379==    by 0x10935E: main (test-resolve-file-path.c:71)
2023-07-19 10:21:30 +01:00
Richard Cohen
69df6ea57d Valgrind: fix "definitely lost" memory in test - test-qofquerycore
==87254== 40 (24 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 107 of 242
==87254==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==87254==    by 0x503B948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==87254==    by 0x502F909: g_list_prepend (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==87254==    by 0x194E83: QofQueryCoreTest_construct_predicate_guid_Test::TestBody() (gtest-qofquerycore.cpp:94)
2023-07-19 10:21:30 +01:00
Richard Cohen
f1e889dbcb Valgrind: fix "definitely lost" memory in test - test-lots
==67054== 320 bytes in 32 blocks are definitely lost in loss record 2,213 of 2,238
==67054==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==67054==    by 0x503C550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==67054==    by 0x118AD8: get_random_transaction_with_currency (test-engine-stuff.cpp:1395)
==67054==    by 0x119897: add_random_transactions_to_book (test-engine-stuff.cpp:1848)
==67054==    by 0x115FE8: run_test() (test-lots.cpp:99)
==67054==    by 0x1160BF: main (test-lots.cpp:135)
==67054==
2023-07-19 10:21:30 +01:00
John Ralls
741ce55b7a Merge Richard Cohen's 'use-g-assert-true-in-tests' into stable. 2023-07-16 10:13:26 -07:00
Richard Cohen
66c5e398ae Change g_assert() -> g_assert_true() in tests
g_assert() can be compiled out, so should not be used for tests

g_assert_true was removed
to fis https://bugs.gnucash.org/show_bug.cgi?id=792008 because
g_assert_true was introduced in glib-2.38 and at the time GnuCash required
only glib-2.26. GnuCash has required glib >= 2.40 since 8acbc41c6 so
g_assert_true can be restored.
2023-07-16 10:09:12 -07:00
John Ralls
583446ade5 Merge Richard Cohen's 'declare-type-app-utils' into stable. 2023-07-16 09:48:22 -07:00
John Ralls
c405ba2cc0 Merge Richard Cohen's 'filter-online-test' into stable. 2023-07-14 15:29:59 -07:00
John Ralls
6b1941f0ed Replace yahoo_json with alphavantage in test-gnc-quotes.
Alas, poor yahoo_json. After months of valiant struggle to keep up
with Yahoo!'s moving their API around the Finance::Quote team has
abandoned it, replacing it with a screen saver. Those tend to be
unstable so use alphavantage for testing.
2023-07-14 15:15:53 -07:00
John Ralls
f2d9230299 Improve error reporting on DBI large number test failures.
There are other reasons than the original bug that can cause failure,
get some more information to understand what's going on.
2023-07-10 13:25:10 -07:00
John Ralls
a4e651ebc6 Fix test-gnc-quotes.
Forgot to change the test's date-time to neutral time.
2023-07-09 11:17:44 -07:00
John Ralls
037c2004c3 Include timezone in price-quote date diagnostic messages. 2023-07-08 16:59:16 -07:00
John Ralls
133ac88618 Bug 798982 - GetQuotes crashes if Finance::Quote returns an empty date.
Don't try to construct a date from an empty string.
2023-07-08 16:47:14 -07:00
John Ralls
e20f60361f Bug 799004 - Update of Prices attaches incorrect Date
Using a "close" time of 16:00 is a nice idea except that we don't know
what timezone it is, so it's not terribly useful. Use neutral time
instead so that the date will be right in all timezones.
2023-07-08 16:12:05 -07:00
Christopher Lam
fde47d1c7f Merge Simon Arlott branch 'gnc-numeric-to-string-leaks'into stable #1695 2023-07-08 16:01:20 +08:00
Christopher Lam
d326cca065 Bug 798998 - Job Report Not Working
GncOptions add support fo GncOptionUIType::JOB
2023-07-05 17:13:54 +08:00
Christopher Lam
59be6f4974 Merge branch 'gsettings-cpp' into stable #1682
plugs a runaway leak
2023-07-04 08:10:53 +08:00
Christopher Lam
b011c81b62 [gnc-backend-dbi.cpp] if returning early, don't allocate char*
this function may return early causing leak from allocating
g_build_filename.
2023-07-02 21:46:29 +08:00
Christopher Lam
d287c30145 [gsettings.cpp] use std::unordered_map which releases on shutdown
Better than a GHashTable schema_hash which is not being destroyed at shutdown
2023-07-01 12:23:58 +08:00
Christopher Lam
9dfe223fc7 [gsettings.cpp] g_settings_schema_unref after g_object_get
g_object_get may be reffing the schema which prevents it freeing.
2023-07-01 12:19:32 +08:00
Christopher Lam
0d326fa100 [io-gncxml-v2.cpp] plug g_strdup leak 2023-07-01 11:59:40 +08:00
John Ralls
a222efbdf3 GncOption debug messages should be in engine not app-utils. 2023-06-29 11:23:04 -07:00
Richard Cohen
52e8524ec5 Refactor: hide implementation of GncSxInstanceModel (move from .h -> .c) 2023-06-29 10:04:34 +01:00
Richard Cohen
d30fdd8071 Refactor: DECLARE_FINAL GncSxInstanceModel < GObject 2023-06-29 10:04:34 +01:00
Richard Cohen
9713683ee3 Refactor: define and use api for GncSxInstanceModel 2023-06-29 10:04:29 +01:00
Simon Arlott
663dfadb90
Fix memory leaks logging with gnc_numeric_to_string()
The value returned by gnc_numeric_to_string() needs to be freed.
Use gnc_num_dbg_to_string() instead.
2023-06-28 08:16:20 +01:00
Simon Arlott
dbf8f93be4
Fix assumption in gnc_num_dbg_to_string()
If the size of "buff" is not evenly divisible by "size" then this would
allocate off the end of the buffer. That's not currently the case but the
calculation shouldn't do this. Change it to check there's actually enough
space.
2023-06-28 08:10:13 +01:00
Vincent Dawans
e0e13604b5 Bug 798967 - Cannot Save to Any Path After Upgrading to 5.2
Fix inverted if statement condition for save success flag
2023-06-25 18:50:58 -07:00
Simon Arlott
069eb61a3f
Avoid the potential negative left shift in test_xaccAccountType_Compatibility()
ACCT_TYPE_NONE is -1 but it should always be masked out by compat;
explicitly check for this instead of relying on that.

Add parenthesis to be clear that the default precedence is what's intended.
2023-06-24 20:30:48 +01:00
Simon Arlott
d7b2b06bae
Avoid unnecessary memory allocation in dom_tree_to_gnc_numeric()
Return a gnc_numeric instead of allocations that every caller has to free.

This makes it easier to fix the use after free in the unit test function
equals_node_val_vs_split_internal() where the expression in the return
statement wants to use the allocated gnc_numeric.
2023-06-24 20:30:42 +01:00
Simon Arlott
fe526a6043
Check source parameter to GncQuotesImpl::report() is not null
The "source" parameter is checked once at the start before using strcmp()
but is then used later on in GncQuotesImpl::query_fq() with function calls
that can't handle null values.
2023-06-24 16:46:45 +01:00
Simon Arlott
4b83068c6b
Fix return value of gnc_book_write_to_xml_file_v2()
81b9a02235 changed the behaviour of the
"success" variable that's used for the return value, so now the value is
being repeatedly overwritten instead of being combined with the result of
the next call.

Restore the original behaviour of setting success to false on failure.
2023-06-24 16:46:44 +01:00
John Ralls
e98d3534ce Bug 798901 - Wrong value for very small prices from Finance::Quote.
Implement parsing number strings in scientific notation, avoiding
interpreting hexadecimal integers that way, "e" being a hex digit.
2023-06-23 14:39:37 -07:00
John Ralls
4c67cc09a6 Merge Richard Cohen's 'valgrind-test-fixes' into stable. 2023-06-22 13:24:56 -07:00
Richard Cohen
fa0824e903 Valgrind: fix "Invalid read" - test-vendor
==4031== Invalid read of size 8
==4031==    at 0x4E58C09: gncVendorGetAddr (gncVendor.c:677)
==4031==    by 0x10A7E3: test_vendor (test-vendor.c:97)
...
==4031==  Address 0x7e0c4e8 is 168 bytes inside a block of size 232 free'd
==4031==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4031==    by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031==    by 0x4E58616: gncVendorFree (gncVendor.c:511)
==4031==    by 0x4E58EFF: vendor_free (gncVendor.c:782)
==4031==    by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4031==    by 0x4E58F59: gncVendorCommitEdit (gncVendor.c:788)
==4031==    by 0x4E584EF: gncVendorDestroy (gncVendor.c:483)
==4031==    by 0x10A729: test_vendor (test-vendor.c:80)
...
==4031==  Block was alloc'd at
==4031==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4031==    by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4031==    by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031==    by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031==    by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031==    by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4031==    by 0x4E583CF: gncVendorCreate (gncVendor.c:459)
==4031==    by 0x10A6A5: test_vendor (test-vendor.c:74)
...
2023-06-21 10:36:35 +01:00
Richard Cohen
2168c6f301 Valgrind: fix "Invalid read" - test-employee
==4029== Invalid read of size 8
==4029==    at 0x4E41F15: gncEmployeeGetAddr (gncEmployee.c:642)
==4029==    by 0x10A8A5: test_employee (test-employee.c:97)
...
==4029==  Address 0x7e0c208 is 152 bytes inside a block of size 248 free'd
==4029==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4029==    by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029==    by 0x4E418D5: gncEmployeeFree (gncEmployee.c:477)
==4029==    by 0x4E42144: emp_free (gncEmployee.c:714)
==4029==    by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4029==    by 0x4E4219E: gncEmployeeCommitEdit (gncEmployee.c:721)
==4029==    by 0x4E41823: gncEmployeeDestroy (gncEmployee.c:459)
==4029==    by 0x10A77F: test_employee (test-employee.c:79)
...
==4029==  Block was alloc'd at
==4029==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4029==    by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4029==    by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029==    by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029==    by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029==    by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4029==    by 0x4E416DA: gncEmployeeCreate (gncEmployee.c:434)
==4029==    by 0x10A6FB: test_employee (test-employee.c:73)
...
2023-06-21 10:36:35 +01:00
Richard Cohen
a5513b45d5 Valgrind: fix "Invalid read" - test-customer
==4028== Invalid read of size 8
==4028==    at 0x4E3F641: gncCustomerGetAddr (gncCustomer.c:579)
==4028==    by 0x10A8EE: test_customer (test-customer.c:90)
...
==4028==  Address 0x7e861b8 is 168 bytes inside a block of size 272 free'd
==4028==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028==    by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x4E3EDD6: gncCustomerFree (gncCustomer.c:368)
==4028==    by 0x4E3F57B: cust_free (gncCustomer.c:551)
==4028==    by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4028==    by 0x4E3F5D5: gncCustomerCommitEdit (gncCustomer.c:557)
==4028==    by 0x4E3EC89: gncCustomerDestroy (gncCustomer.c:338)
==4028==    by 0x10A7EC: test_customer (test-customer.c:71)
...
==4028==  Block was alloc'd at
==4028==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028==    by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4028==    by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x4E3EB0D: gncCustomerCreate (gncCustomer.c:309)
==4028==    by 0x10A768: test_customer (test-customer.c:66)
...

==4028== Invalid read of size 8
==4028==    at 0x4E3F796: gncCustomerGetShipAddr (gncCustomer.c:633)
==4028==    by 0x10A91D: test_customer (test-customer.c:91)
...
==4028==  Address 0x7e86210 is 256 bytes inside a block of size 272 free'd
==4028==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028==    by 0x51526C3: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x4E3EDD6: gncCustomerFree (gncCustomer.c:368)
==4028==    by 0x4E3F57B: cust_free (gncCustomer.c:551)
==4028==    by 0x4E8611E: qof_commit_edit_part2 (qofinstance.cpp:1034)
==4028==    by 0x4E3F5D5: gncCustomerCommitEdit (gncCustomer.c:557)
==4028==    by 0x4E3EC89: gncCustomerDestroy (gncCustomer.c:338)
==4028==    by 0x10A7EC: test_customer (test-customer.c:71)
...
==4028==  Block was alloc'd at
==4028==    at 0x4848A13: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==4028==    by 0x5033550: g_malloc0 (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==4028==    by 0x5157CBC: g_type_create_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x513F20F: ??? (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x51407B7: g_object_new_with_properties (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x5141560: g_object_new (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.7600.1)
==4028==    by 0x4E3EB0D: gncCustomerCreate (gncCustomer.c:309)
==4028==    by 0x10A768: test_customer (test-customer.c:66)
...
2023-06-21 10:36:35 +01:00
Richard Cohen
a1893ef51b Valgrind: fix "Invalid read" - test-kvp-value
==7520== Invalid read of size 8
==7520==    at 0x4E36DCC: guid_copy (guid.cpp:123)
==7520==    by 0x1E3E62: KvpValueImpl::duplicate(KvpValueImpl const&) (kvp-value.cpp:378)
==7520==    by 0x1E31CC: KvpValueImpl::KvpValueImpl(KvpValueImpl const&) (kvp-value.cpp:36)
==7520==    by 0x1FF6C3: KvpValueTest_Copy_Test::TestBody() (test-kvp-value.cpp:74)
...
==7520==  Address 0x7e10f48 is 8 bytes inside a block of size 16 free'd
==7520==    at 0x4846AFF: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==7520==    by 0x4E36D98: guid_free (guid.cpp:115)
==7520==    by 0x1E3D04: void delete_visitor::operator()<_gncGuid*>(_gncGuid*&) (kvp-value.cpp:358)
...
==7520==  Block was alloc'd at
==7520==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==7520==    by 0x4E36D5C: guid_malloc (guid.cpp:105)
==7520==    by 0x4E36DC3: guid_copy (guid.cpp:122)
==7520==    by 0x4E36EB0: guid_new (guid.cpp:153)
==7520==    by 0x1FF4DB: KvpValueTest_Copy_Test::TestBody() (test-kvp-value.cpp:68)
2023-06-21 10:36:35 +01:00
Richard Cohen
46e6477f88 Refactor: use common code to free the list of guids 2023-06-21 10:36:31 +01:00
Richard Cohen
f1a3f2a8c8 Valgrind: fix "Mismatched free/delete" - test-scm-query etc.
- test-scm-query
- test-print-queries
- test-scm-query-string

==14597== Mismatched free() / delete / delete []
==14597==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==14597==    by 0x118851: free_random_guids(_GList*) (test-engine-stuff.cpp:1505)
==14597==    by 0x118CF5: get_random_query (test-engine-stuff.cpp:1674)
...
==14597==  Address 0xa1366a0 is 0 bytes inside a block of size 16 alloc'd
==14597==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==14597==    by 0x5342FA6: guid_malloc (guid.cpp:106)
==14597==    by 0x534300D: guid_copy (guid.cpp:123)
==14597==    by 0x534311F: guid_new (guid.cpp:154)
==14597==    by 0x115D1A: get_random_guid (test-engine-stuff.cpp:207)
==14597==    by 0x1187FA: get_random_guids(int) (test-engine-stuff.cpp:1494)
==14597==    by 0x118CC0: get_random_query (test-engine-stuff.cpp:1668)
...

==15045== Mismatched free() / delete / delete []
==15045==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==15045==    by 0x118E96: get_random_query (test-engine-stuff.cpp:1735)
...
==15045==  Address 0xa077d40 is 0 bytes inside a block of size 16 alloc'd
==15045==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==15045==    by 0x5342FA6: guid_malloc (guid.cpp:106)
==15045==    by 0x534300D: guid_copy (guid.cpp:123)
==15045==    by 0x534311F: guid_new (guid.cpp:154)
==15045==    by 0x115D1A: get_random_guid (test-engine-stuff.cpp:207)
==15045==    by 0x118E65: get_random_query (test-engine-stuff.cpp:1730)
...
2023-06-21 10:36:25 +01:00
John Ralls
b041a76690 [c++options]Dirty and changed are different.
Report options need to be saved when they're different from the
defaults, book options need to be saved when their value changes
regardless of whether it's the default value. That's dirty. Implement
it.
2023-06-20 14:50:42 -07:00
John Ralls
08d083e8e1 Merge Richard Cohen's 'fix-memory-errors' into stable. 2023-06-20 12:13:45 -07:00
John Ralls
7381887bfc Merge Vincent Dawan's 'bug798952-counters' into stable. 2023-06-20 11:02:17 -07:00
Richard Cohen
958e9a4d6f Valgrind: fix "Invalid read" in test-exp-parser
The pointer passed to the gfec exception handler is
not valid after the exception handler ends

==382525== Invalid read of size 1
==382525==    at 0x484B050: memcpy@GLIBC_2.2.5 (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525==    by 0x531AB67: __printf_buffer_write (Xprintf_buffer_write.c:39)
==382525==    by 0x5322CD4: __printf_buffer (vfprintf-process-arg.c:501)
==382525==    by 0x53465F3: __vasprintf_internal (vasprintf.c:102)
==382525==    by 0x499C8C1: g_vasprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525==    by 0x4969BE0: g_strdup_vprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525==    by 0x494B2F6: g_logv (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525==    by 0x494B7A2: g_log (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==382525==    by 0x4862862: func_op (gnc-exp-parser.c:342)
==382525==    by 0x485D381: primary_exp (expression_parser.c:1222)
==382525==    by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525==    by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525==  Address 0xad387ec is 764 bytes inside a block of size 766 free'd
==382525==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525==    by 0x4861D9B: gfec_apply (gfec.c:145)
==382525==    by 0x4862813: func_op (gnc-exp-parser.c:339)
==382525==    by 0x485D381: primary_exp (expression_parser.c:1222)
==382525==    by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525==    by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525==    by 0x485C9DE: assignment_op (expression_parser.c:886)
==382525==    by 0x485C101: parse_string (expression_parser.c:605)
==382525==    by 0x4862F07: gnc_exp_parser_parse_separate_vars (gnc-exp-parser.c:535)
==382525==    by 0x4862D60: gnc_exp_parser_parse (gnc-exp-parser.c:475)
==382525==    by 0x10A963: run_parser_test (test-exp-parser.c:94)
==382525==    by 0x10AB99: run_parser_tests (test-exp-parser.c:144)
==382525==  Block was alloc'd at
==382525==    at 0x4843738: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==382525==    by 0x4A81473: scm_realloc (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==382525==    by 0x4AEEF70: scm_to_utf8_stringn (in /usr/lib/x86_64-linux-gnu/libguile-3.0.so.1.5.0)
==382525==    by 0x55AA71F: gnc_scm_to_utf8_string (gnc-guile-utils.c:42)
==382525==    by 0x4861D4E: gfec_apply (gfec.c:136)
==382525==    by 0x4862813: func_op (gnc-exp-parser.c:339)
==382525==    by 0x485D381: primary_exp (expression_parser.c:1222)
==382525==    by 0x485CE0F: multiply_divide_op (expression_parser.c:1028)
==382525==    by 0x485CC33: add_sub_op (expression_parser.c:968)
==382525==    by 0x485C9DE: assignment_op (expression_parser.c:886)
==382525==    by 0x485C101: parse_string (expression_parser.c:605)
==382525==    by 0x4862F07: gnc_exp_parser_parse_separate_vars (gnc-exp-parser.c:535)
2023-06-20 10:20:44 +01:00
Vincent Dawans
b514245c22 Bug 798952 - Unable to set day threshold or counters in properties
Make sure counter values are retrieved as int; allow counter back
to zero; fix voucher default value.
2023-06-19 19:23:04 -07:00
Christopher Lam
b331ec974e [gnc-gsettings.cpp] plug a char* leak
full_name leaks if it's already in schema_hash hash table. It would be
better to convert GHashTable to unordered_map.
2023-06-20 09:21:49 +08:00
Richard Cohen
2e861ab673 Valgrind: fix "Mismatched free/delete" - test-dom-converters1
==32195== Mismatched free() / delete / delete []
==32195==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==32195==    by 0x146DB5: test_dom_tree_to_guid() (test-dom-converters1.cpp:251)
...
==32195==  Address 0x8043780 is 0 bytes inside a block of size 16 alloc'd
==32195==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==32195==    by 0x503E06E: guid_malloc (guid.cpp:106)
==32195==    by 0x503E0D5: guid_copy (guid.cpp:123)
==32195==    by 0x503E1E7: guid_new (guid.cpp:154)
==32195==    by 0x147188: get_random_guid (test-engine-stuff.cpp:207)
==32195==    by 0x146D03: test_dom_tree_to_guid() (test-dom-converters1.cpp:237)
...
2023-06-19 13:53:24 +01:00
Richard Cohen
e5a26e3c77 Valgrind: fix "Mismatched free/delete" - test-query
==31803== Mismatched free() / delete / delete []
==31803==    at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==31803==    by 0x1198CB: make_trans_query (test-engine-stuff.cpp:2030)
==31803==    by 0x115898: test_trans_query(transaction_s*, void*) (test-query.cpp:40)
...
==31803==  Address 0x7fed160 is 0 bytes inside a block of size 16 alloc'd
==31803==    at 0x4843FA3: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==31803==    by 0x4E3706E: guid_malloc (guid.cpp:106)
==31803==    by 0x4E370D5: guid_copy (guid.cpp:123)
==31803==    by 0x4E371E7: guid_new (guid.cpp:154)
==31803==    by 0x115D64: get_random_guid (test-engine-stuff.cpp:207)
==31803==    by 0x11984C: make_trans_query (test-engine-stuff.cpp:2023)
...
2023-06-19 13:53:24 +01:00
Richard Cohen
4018ff1722 Valgrind: fix "Mismatched free/delete" - test-kvp-frames etc.
- test-kvp-frames
- test-xml-account
- test-xml-transaction
- test-account-object
- test-group-vs-book
- test-lots
- test-query
- test-import-pending-matches

==30223== Mismatched free() / delete / delete []
==30223==    at 0x4846AFF: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==30223==    by 0x4E370AA: guid_free (guid.cpp:116)
...
==30223==  Address 0x7ea4390 is 0 bytes inside a block of size 16 alloc'd
==30223==    at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==30223==    by 0x5032948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==30223==    by 0x11603A: get_random_guid (test-engine-stuff.cpp:209)
...
2023-06-19 13:53:24 +01:00
John Ralls
241aa1d2eb Merge Richard Cohen's 'remove-unneeded-memcpy' into stable. 2023-06-17 17:58:53 -07:00
John Ralls
aae568eca6 Add comment explaining "option.template get_value<int>()". 2023-06-17 16:58:03 -07:00
John Ralls
4dc8a7ee0d Bug 798952 - Unable to set day threshold or counters in properties
Make counters explicitly integer type and adjust the kvp load and save functions
to recognize that and behave accordingly so that other range options like day
threshold aren't affected.
2023-06-17 16:49:52 -07:00
John Ralls
827bfabd69 Merge Richard Cohen's 'declare-type-gnc-plugin' into stable. 2023-06-16 12:42:42 -07:00
Richard Cohen
3abc9a5558 Refactor: Remove some unnecessary uses of memcpy
- Also, remove unnecessary "static" in gnucash-style.c

The second one in guid.cpp is UB:

libgnucash/engine/guid.cpp:137:5: warning: undefined behavior, source object type 'const gnc::GUID' is not TriviallyCopyable [bugprone-undefined-memory-manipulation]
        memcpy (&target, &source, sizeof (GncGUID));
        ^
2023-06-15 11:10:58 +01:00
Christopher Lam
4a60e01fcd bugfix xaccTransGetTxnType: avoid returning TXN_TYPE_LINK incorrectly
A TXN_TYPE_PAYMENT will have non-APAR splits; a TXN_TYPE_LINK will not
have non-APAR splits. This bug manifests as a regular TXN_TYPE_PAYMENT
transaction being later voided being incorrectly changed to
TXN_TYPE_LINK.
2023-06-14 18:29:00 +08:00
Richard Cohen
1255d61917 Refactor: hide implementation of GncPlugin* (move from .h -> .c) 2023-06-14 11:03:37 +01:00
Richard Cohen
2e59bda951 Refactor: DECLARE_FINAL GncPluginExample < GncPlugin
- Fix the name
2023-06-14 11:03:37 +01:00
John Ralls
0d1ba1ebe7 Merge Richard Cohen's 'y2038-fixes' into stable. 2023-06-12 14:44:11 -07:00
Christopher Lam
8ec6a4cb12 [Scrub.c] 8628ca8715 rewritten to avoid QofQuery
because QofQuery will include the blank transaction which must not be
scrubbed.
2023-06-12 23:59:37 +08:00
Richard Cohen
7d26b8c05f Fail the test if still using 32bit time_t in 2038
gtest-gnc-option.cpp and gtest-gnc-optiondb.cpp need to call
time() for g_date_set_time_t()
2023-06-08 14:30:32 +01:00
Richard Cohen
d63248dad2 Update Y2038 comments 2023-06-08 14:30:28 +01:00
Christopher Lam
3ccb5c4896 Merge branch 'wordsmithing' into stable #1658 2023-06-07 22:00:06 +08:00
John Ralls
dda661cfd2 Merge Richard Cohen's 'more-define-types' into stable. 2023-06-06 21:27:36 -07:00
Christopher Lam
f580a6cf2d [gnc-ui-balances.c] better wording for balance limits 2023-06-07 08:49:01 +08:00
John Ralls
a5ff19b62a Merge Richard Cohen's 'fix-incorrect-logging-after-fallthrough' into stable. 2023-06-06 14:59:05 -07:00
Richard Cohen
6e5c525f77 Use gnc_time() instead of time() 2023-06-06 15:40:36 +01:00
Richard Cohen
fde90c4c99 Restore test-gnc-option
- removed in merge 3e5fcc8709

To get it to compile

- remove unused variables
- remove duplicate operator==(GncGUID)
2023-06-06 15:34:07 +01:00
Richard Cohen
a0fd9af394 Fix incorrect logging after switch fallthrough
oops
2023-06-06 15:16:39 +01:00
Christopher Lam
ccc75cfc88 Merge branch 'scrub-optimize' into stable 2023-06-04 07:58:31 +08:00
Christopher Lam
81902ba8bb [scrub.c] xaccTransScrubSplits calls Begin/Commit only if required 2023-06-02 18:01:08 +08:00
Christopher Lam
872e20c555 move xaccTransScrubSplits to Scrub.c
it's defined in Scrub.h anyway
2023-06-01 20:28:01 +08:00
Richard Cohen
680fe47bac Refactor: Remove unused macros GNC_BASIC_GOBJECT_* 2023-06-01 10:32:02 +01:00
Christopher Lam
9047156017 [Scrub.c] refactor xaccAccountTreeScrubOrphans 2023-05-31 19:34:28 +08:00
Christopher Lam
8628ca8715 [Scrub.c] refactor xaccAccountTreeScrubImbalance
The scrubbing routines are transaction oriented. Instead of
xaccAccountTreeScrubImbalance calling xaccAccountScrubImbalance for
each descendant, refactor so that the transaction list is generated
only once. The scrubbing is faster and progress bar is more accurate.
2023-05-31 09:26:58 +08:00
Christopher Lam
d214b2f05d Merge Vincent Dawans' branch 'bug798879' into stable #1617 2023-05-30 22:41:05 +08:00
Vincent Dawans
1c04e744d3 [trep-engine.scm] Rename "Totals" option to "Grand Total" 2023-05-29 20:01:11 -07:00
John Ralls
dd5be317d8 Merge Richard Cohen's 'define-type' into stable. 2023-05-27 10:09:05 -04:00
John Ralls
6111184c73 Ensure incorrectly coded counter KVP is read correctly.
Bug 798930 caused some counters to be saved as KVP double. If the
correct int64_t value isn't found when reading, or if a double is
encountered when loading the option dialog, get the double value
and cast it to int64_t.
2023-05-26 21:24:06 -04:00
John Ralls
7d5663899c Bug 798930 - invoices wont sequence to the next number
Because KVP can't magically cast between int64_t and double.
2023-05-26 20:41:13 -04:00
Richard Cohen
5d955654bc Refactor: DEFINE_TYPE GncSxInstanceModel < GObject 2023-05-26 13:34:09 +01:00
John Ralls
3d30e5978a Merge Richard Cohen's 'define-boxed' into stable. 2023-05-25 10:50:08 -04:00
Richard Cohen
ae9304efb0 Remove unused boxed type gnc_value_list 2023-05-25 14:42:28 +01:00
Richard Cohen
f9efbf86c6 Remove unused Qofbook::ab-templates property 2023-05-25 14:42:28 +01:00
John Ralls
8a5b3721df Merge Richard Cohen's 'remove-duplicate-define-type-code' into stable. 2023-05-24 11:25:16 -04:00
Mike Alexander
6bdaa161eb Redo 71afa3e0 and 71afa3e0 so powten(max_leg_digits) is 1e18
This is what it was before 71afa3e0.  This is the largest power of
ten that fits in an int64.
2023-05-22 15:24:26 -04:00
Christopher Lam
89f7e8933b gnc_list_all_paths returns std::vector instead of GList of EnvPaths
because its consumers are now cpp there's no need to return a GList.
2023-05-22 09:45:33 +08:00
Richard Cohen
2db5004a22 Remove code that duplicates features of G_DEFINE_TYPE
- declarations of *_init, *_class_init
- implementation of *_parent_class

- also, removed unnecessary NULL checks for destroy, dispose, finalize
2023-05-21 15:21:33 +01:00