Commit Graph

1237 Commits

Author SHA1 Message Date
John Ralls
edad194389 Bug 798180 - Update to macOS Big Sur 11.3 breaks Finance Quote
Added new dependency Test2 to gnc-fq-update. This is a second-order
dependency of Finanance::Quote that CPAN doesn't seem to recognize
on its own.
2021-09-11 16:09:55 -07:00
John Ralls
cd0d50aac1 Deprecate date options with a time of day setting.
Removing the only use, an example in hello-world.scm. GnuCash doesn't
use this value in any of its own report options and the feature will
be removed in GnuCash 5.

Related to bug 798297 Pref "Use 24-hour clock" obsolete?.
2021-09-10 12:21:46 -07:00
John Ralls
8ab8642e76 Fix leak of trading_splits list in xaccTransClearTradingSplits 2021-09-09 16:32:43 -07:00
John Ralls
1387d5f960 Fix unchecked ptr dereference.
First crash in Bug 798225.
2021-09-09 16:32:43 -07:00
John Ralls
ab24c34660 Merge Simon Arlott's 'free-template-root' into maint. 2021-09-07 12:14:41 -07:00
Simon Arlott
4a8acf3fb2 Free template root accounts on book end
The template root should be unset so that it's destroyed when the book is
ending. This is required to free all the template accounts and referenced
strings.

The scheduled transactions themselves need to be freed first so reverse
the order that SXRegister and gnc_sxtt_register are called in
cashobjects_register: The list resulting from that function is traversed
from the bottom up.
2021-09-07 12:11:05 -07:00
John Ralls
901fea158f Merge Simon Arlott's 'xml-locking-fixes' into maint. 2021-09-06 15:22:49 -07:00
John Ralls
38cd06e54a Remove the lock-file-link-count test from the XML backend.
This was an effort of somewhat dubious value to detect if a process
on another ocmputer had a hsrd-link to a lockfile on an NFS share.
NFS is rarely used now and SMB doesn't support hard links so this check
adds complexity with no real value.
2021-09-06 15:18:34 -07:00
John Ralls
079a900300 Bug 798298 - Re-imported transactions no longer ignored
Merges Jean Laroche's '798298_reimport_ofx' into maint.
2021-09-06 13:51:26 -07:00
Mike Alexander
068a5d2fa8 Fix xaccSplitGetOtherSplit which was broken by 028bf9826, don't
count splits that aren't really in the transaction.

The rewrite left out one test.  This was most obvious in the dummy
transaction used to enter a new transaction into an account.
xaccSplitGetOtherSplit never returned an "other split" for this
transaction.  It turns out the old code was broken too, but
it worked for this case by coincidence.
2021-09-06 02:45:37 -04:00
jean
4e9fe0a4d1 Add missing function to mock account 2021-09-05 17:52:34 -07:00
Christopher Lam
1eb6709331 [test-lots.cpp] add kvp getter/setter changes 2021-08-31 23:16:43 +08:00
Christopher Lam
323182c9f7 [utest-Account.cpp] add kvp getter/setter changes 2021-08-31 23:16:43 +08:00
Christopher Lam
8a37c4c019 [utest-Invoice.c] add kvp getter/setter tests 2021-08-31 23:16:43 +08:00
Christopher Lam
9ec670f828 [test-commodities.cpp] add kvp setter/getter test 2021-08-31 23:16:42 +08:00
Christopher Lam
d4c8b36f9f [utest-Transaction.cpp] add kvp setter/getter tests
wasn't tested before
2021-08-31 23:16:42 +08:00
Christopher Lam
c3b50f0b58 [gnc-lot.c] fix - cache value properly 2021-08-31 23:16:42 +08:00
Christopher Lam
595e126a34 [account.cpp] modify set_kvp_string_tag to accept strstrip or nullptr
- will remove a second call to g_strstrip (g_strdup (str))
2021-08-31 23:16:42 +08:00
Christopher Lam
c5a6383b43 [account.cpp] fix - incomplete #1117
- init struct members properly to: is_unset and TriState::Unset
- test acct kvp "equity-type" for "opening-balance" instead of "true"
- cached account->color/sort_order/notes/filter gets strstripped
  similarly to previous behavior
2021-08-31 23:16:42 +08:00
Christopher Lam
001b34616f [Transaction.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
a47bee97d6 [Split.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
0ecbcb4ef1 [gnc-lot.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
ac2afc7e13 [gncInvoice.c] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
3bf49ed8d7 [Account.cpp] GValue string must be unset 2021-08-29 15:38:16 +08:00
Christopher Lam
e3af2f22f9 [gnc-commodity.c] cache user_symbol into commodity struct
Continuation of ff2ceb111 which introduced issue whereby user_symbol
returned could become stale, leading to invalid read fixed with
c398bef59. There are likely other user_symbol pointers becoming stale
without this commit.

This change will save the user_symbol into the commodity struct,
avoids gchar* becoming stale.
2021-08-29 15:38:16 +08:00
John Ralls
57f73d70c7 Merge Yordan Miladinov's denom_lcd into maint. 2021-08-27 12:34:07 -07:00
Christopher Lam
c55ab50349 [gnc-budget.c] gnc_budget_get_account_period_note to be freed by the caller 2021-08-24 23:02:15 +08:00
Christopher Lam
9ddb9e8215 [gnc-module.c] free a GList* properly
g_list_free (current) was a NOP because current became NULL after the
preceding GList traversal.
2021-08-24 22:32:39 +08:00
Simon Arlott
0665208299
xml-backend: Lock file is deleted even if the lock is not acquired
The lock file is set in m_lockfile and then unlinked in session_end even if
the lock was not acquired.

Clear m_lockfile if locking was not successful.
2021-08-24 09:29:47 +01:00
Simon Arlott
e4619fdae6
xml-backend: Don't try to close m_lockfd if it's not open
m_lockfd is not initialised. If the file is locked then it will not be set
before session_end and close() will be called on an uninitialised int.

Initialise it to -1 in the class definition.
Consistently use -1 instead of "< 0" or "< 1" as the definition of invalid.
Always set it to -1 after closing it.
2021-08-24 09:29:45 +01:00
Yordan Miladinov
6cb509ea7d
fix an uncaught exception: denom_lcd may throw an overflow exception if casting lcm to int64_t fails 2021-08-24 00:58:31 +03:00
Christopher Lam
7e41efc232 Merge branch 'maint-speedup-and-leaks' into maint #1109
Speedup xaccSplitGetOtherSplit
2021-08-20 21:23:35 +08:00
Christopher Lam
ff2ceb111d [gnc-commodity] GValue must be unset 2021-08-20 17:02:58 +08:00
Christopher Lam
028bf9826b [Split] xaccSplitGetOtherSplit don't test book trading-accts
don't test trading-acct property when finding other split.
2021-08-17 13:04:34 +08:00
Christopher Lam
6bf5a618de qof_instance_get gchar* must be freed
A call to qof_instance_get expecting a gchar* receives a newly
allocated string which must be freed.
2021-08-15 09:49:06 +08:00
Christopher Lam
e4d808e674 [qofbook] qof_book_use_split_action_for_num_field: free a char*
qof_instance_get allocates a new char* which must be freed.
2021-08-13 08:58:07 +08:00
Christopher Lam
40d886fa9d gnc_account_list_name_violations elements must be freed 2021-08-12 09:39:08 +08:00
Christopher Lam
4c37f6d4ef [account.cpp] gnc_g_list_stringjoin instead of repeated allocations 2021-08-12 09:19:34 +08:00
Christopher Lam
e84549926b [gnc-glib-utils] gnc_g_list_stringjoin to join a GList of strings
It traverses the GList twice (once to calculate the length) but
allocates only once.

Includes snippet from
https://www.joelonsoftware.com/2001/12/11/back-to-basics/
2021-08-12 09:19:34 +08:00
Christopher Lam
bedc85afa3 Merge branch 'maint-leaks' into maint #1101 2021-08-06 19:30:01 +08:00
Christopher Lam
0420ae6a66 [account.cpp] refactor gnc_account_list_name_violations 2021-08-06 17:31:36 +08:00
Christopher Lam
67bd513514 [account.cpp] rewrite gnc_account_foreach_descendant_until in C++ 2021-08-06 17:31:36 +08:00
Christopher Lam
17953441cb [account.cpp] refactor gnc_account_foreach_descendant 2021-08-06 17:31:36 +08:00
Christopher Lam
5698b67bf5 [account.cpp] refactor gnc_account_lookup_by_code 2021-08-06 17:31:36 +08:00
Christopher Lam
09e2e7613c [account.cpp] refactor gnc_account_lookup_by_name 2021-08-06 17:31:36 +08:00
Christopher Lam
bebc366e88 [account.cpp] refactor gnc_account_n_descendants 2021-08-06 17:31:35 +08:00
John Ralls
f0926d66c1 Merge Simon Arlott's 'qof-instance-dispose' into maint. 2021-08-05 11:45:14 -07:00
Christopher Lam
e6c33a39bc [account.cpp] refactor gnc_account_get_descendants{_sorted} 2021-08-06 00:23:12 +08:00
Christopher Lam
d2db43019c [account.cpp] internal function account_foreach_descendant
fast and efficient
2021-08-06 00:23:12 +08:00
Christopher Lam
de1ad9367a g_free gnc_ctime which returns a new gchar* 2021-08-05 21:42:31 +08:00