Commit Graph

1973 Commits

Author SHA1 Message Date
Christopher Lam
e26c3d6cf4 [gnc-ui-balances.c] gnc_ui_account_get_balance_limit_explanation
returns a char* explanation, or NULL
2023-04-22 14:22:40 +08:00
Vincent Dawans
761d7f29a5 Bug 765920 - Running balance not accurate when sorted different ways
- Renamed option to "Account Balance" to avoid confusion with running
  total.
- Added helper function to ensure running balance and balance forward
  are only shown when transaction are grouped by account and sorted as
  in register. In that case column heading remains "Running Balance"
  and balance forward is shown. Otherwwise column heading is renamed
  "Account Balance" and balance forward is not shown.
- Also added missing code for Common Currency conversion.
2023-04-21 09:13:16 -07:00
John Ralls
4a5b897d89 Bug 798863 - Crash on clicking Settings button second time
Ensure that dialog resources stored in options are freed when the
dialog is destroyed.

The crash happened when a new dialog replaced the old one on the options
and the old one's destructors tried to access a dangling reference to
a GtkWidget.
2023-04-20 20:08:38 -07:00
John Ralls
f4f481fe38 Bug 798812 - crashes after I open a customer report and select…
Edit/Report Options

As a result of auto instead of auto& in a std::visit call which
resulted in a temporary option whose GncOwner* was destroyed before
we could use it.
2023-04-15 13:29:40 -07:00
Robert Fewell
0d84506a5e Bug 798851 - Account Balance 'include subaccounts' not saved
The defaults for the account were removed by mistake in a previous
commit, added them back.
2023-04-12 11:20:32 +01:00
John Ralls
2f471e65a7 Bug 798802 - Online Price quote - Stocks not working GNU 5.0 Windows Bis
The previous change of the delimiter between namespace and symbol
is needed in both overloads of GncQuoteImpl::query_fq.

Also log the query json string to ease future troubleshooting.
2023-04-09 15:24:53 -07:00
Richard Cohen
6ba5bb326a Fix dereference of expired temporaries.
Reported by clang 15.0.7, which will be in Ubuntu 23.04, -Wdangling-gsl
2023-03-31 11:27:33 -07:00
Richard Cohen
9fa2a48fe1 Fix build on gcc-8 & 9.
See https://lists.gnucash.org/pipermail/gnucash-devel/2023-March/046617.html
2023-03-30 18:25:23 -07:00
John Ralls
0d598d51ed Fix Finance::Quote use on Win32.
By dealing with Win32 \r\n newlines on return from finance-quote-wrapper.
2023-03-30 16:45:01 -07:00
John Ralls
a587dfff2c Bug 798802 - Online Price quote - Stocks not working GNU 5.0 Windows
Change the property-tree path delimiter for constructing paths from
'.' that's commonly used in stock symbols, to '|' that isn't.
2023-03-29 20:01:10 -07:00
Christopher Lam
bdf79f7721 Merge branch 'master-fileopen-filter' into stable #1576 2023-03-27 12:48:52 +08:00
John Ralls
89f41a305c Merge new potfile reflecting string changes. 2023-03-24 14:28:24 -07:00
John Ralls
576fc9b52c Fix quotes on Windows.
Boost process wchar_t conversion chokes if it's fed an empty string.
This would happen when the user had no alphavantage key. Separate
the process invocation to not present the empty value to boost process.
2023-03-19 10:32:26 -07:00
John Ralls
90e1e2d1c3 Merge Bob Fewell's 'bug798558' into master. 2023-03-19 10:11:42 -07:00
John Ralls
0c3e85404d Avoid crash from trying to free an unallocated char*. 2023-03-19 10:09:01 -07:00
Christopher Lam
97f0653238 [gnc-quotes] g_free a char* from gnc_prefs_get_string
ultimately gets char* from g_settings_get_string and must be freed
2023-03-20 00:40:41 +08:00
Robert Fewell
a576dd87a4 Bug798558 - Irregular line spacing in Account Tree View
When securities are in the list, the rows look twice as high as though
there is a linefeed at the end. This is partly due to commit for bug
797501 which worked at the time but a change in pango 50.4 to do with
wrapping has highlighted this bug.

To fix this only wrap currencies with ltr bidi isolate characters in
gnc_print_amount_with_bidi_ltr_isolate
2023-03-19 13:53:41 +00:00
John Ralls
00c560d8f5 Move operator==(const GncGUID&, const GncGUID&) to guid.[ch]pp. 2023-03-18 13:53:49 -07:00
John Ralls
352ab8a0e5 Merge Richard Cohen's 'minor-options-fixes' into master. 2023-03-18 12:19:50 -07:00
John Ralls
d192be5307 Merge Richard Cohen's 'cleanup-cflags-deprecated' into master. 2023-03-18 10:07:25 -07:00
Richard Cohen
24f52d9b17 Remove incorrect operator!= for GncItem
It's better to use the default std::pair implementation

- spotted by clang-tidy bugprone-suspicious-string-compare
- will always return false, because type is the same

Also,
- remove redundant "using GncItem ..."
2023-03-17 16:50:17 +00:00
Richard Cohen
b5f3f99035 Fix incorrect use of remove_if()
- spotted by clang-tidy bugprone
- probably no visible effects because of uniqueness, and other checks

libgnucash/engine/gnc-optiondb.cpp:149:5: warning: this call will remove at most one item even when multiple items should be removed [bugprone-inaccurate-erase]
    m_options.erase(std::remove_if(m_options.begin(), m_options.end(),
    ^

libgnucash/engine/gnc-optiondb.cpp:358:5: warning: the value returned by this function should be used [bugprone-unused-return-value]
    std::remove_if(m_callbacks.begin(), m_callbacks.end(),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libgnucash/engine/gnc-optiondb.cpp:358:5: note: cast the expression to void to silence this warning
2023-03-17 16:50:11 +00:00
John Ralls
b4b8431984 Bug 798778 - GnuCashquits abruptly when attempting to edit options…
for certain reports.

Those reports being ones using complex options, apparently because
the callbacks weren't protected from Guile's garbage collector.

So replace the anyway ugly hack of a void* with a std::any wrapping
a class holding a std::unique_ptr with a custom deleter. The
constructor calls scm_gc_protect_object on the SCM containing the
callback and the custom deleter calls scm_gc_unprotect_object. The
copy constructor, required for std::any, makes a new std::unique_ptr
and calls scm_gc_protect_object again ensuring that the protect and
unprotect calls are symmetrical.

Meanwhile std::any hides the Guile dependency from all the classes
that don't need to know about it. The only ugliness is that there's
no good place to put a common implementation of SCNCallbackWrapper so it's
repeated in gnc-optiondb.i and dialog-options.cpp.
2023-03-16 17:50:06 -07:00
Christopher Lam
dd0d65d861 [1/2] [gnc-filepath-utils.cpp] gnc_filename_is_backup|datafile
uses std::regex to test filename
2023-03-16 18:01:09 +08:00
Richard Cohen
30586ac3e6 Push -Wno-error=deprecated-declarations from C*_FLAGS down to the target 2023-03-15 10:34:14 +00:00
Geert Janssens
1f0a69a804 Properly parse plus signs while importing numbers
Silly copy/paste error.
2023-03-15 08:58:07 +01:00
John Ralls
a44b3664e2 [c++options] Implement GncOptionGncOwnerValue class.
GncOwners aren't QofInstances and have limited lifetimes so an option
must hold its own, wrapped in std::unique_ptr for memory management.
2023-03-14 16:11:39 -07:00
John Ralls
8db8105850 [c++options] Warn when an option variant type's set_value isn't found. 2023-03-14 16:11:39 -07:00
John Ralls
83829e6513 Merge branch 'maint' 2023-03-14 10:43:45 -07:00
John Ralls
1020bde89c Fix crashes in test-engine on Arch Linux.
Root cause is mutating a list while it's iterating. We're able to
protect it in two cases, have to copy it in xaccTransScrubGainsDate.
2023-03-14 10:33:39 -07:00
Geert Janssens
d75ab275f1 Eliminate gnc-csv-account-map.[ch]
The code is was only used by the csv import assistant and forced
gtk as a dependency on gnc-imp-props-tx

Part has been moved to Account, other bits have
been moved to the importer code where they were
used.
2023-03-13 19:58:10 +01:00
Geert Janssens
13ec4bb594 xaccParseAmount... - some code cleanups
- declare at first use
- compact tests
- reduce use of {}
2023-03-13 19:58:10 +01:00
Geert Janssens
8010d9646c Restore proper indentation
It got mixed up while refactoring the various xaccParseAmountXYZ functions
2023-03-13 19:58:10 +01:00
John Ralls
07d8ebd90c Add JSON::Parse to gnc-fq-update.
Required by finance-quote-wrapper to interpret quoter output.
2023-03-10 12:51:30 -08:00
Richard Cohen
329a2f7d42 Guard against some possible null pointer dereferences
Found by gcc 12 when compiling with "-O2 -Wnull-dereference"
2023-03-08 11:00:56 +00:00
Richard Cohen
3a7464a312 Remove redundant uses of cmake -E env
- In GncAddTest, set_tests_properties() is already setting the env
- In the other uses, there is no change to the environment
2023-03-07 15:44:43 +00:00
John Ralls
cdb674ebf1 [c++options]Really fix the gnc_option_db_lookup_string_value leak
By deleting the function and using GncOptionDbImpl::lookup_string_option
directly. It returns a string that we don't have to worry about
memory-managing.

Also create a new GncOptionDbImpl::set_string_option to replace
gnc_option_db_set_string_value.
2023-03-06 11:43:50 -08:00
John Ralls
92071e8844 [c++options] Fix leak. 2023-03-05 10:14:20 -08:00
John Ralls
f735c64cac Merge Richard Cohen's 'extern-c-part2' into master. 2023-03-04 13:51:07 -08:00
Richard Cohen
7b47c07f8e Don't use extern "C" around #includes
Some I missed the first time. Some are new.
2023-03-03 18:55:42 +00:00
Frank H. Ellenberger
bdb12fd94f I18N: Change TaxTable to "Tax Table" for consistency 2023-03-03 09:58:01 -08:00
John Ralls
bbfa378783 Don't crash and do pass tests. 2023-03-02 17:03:39 -08:00
John Ralls
af02dae286 Fixups for merging into master instead of maint. 2023-03-02 17:02:46 -08:00
John Ralls
1eecb9f5c0 [c++ options] Fix locale dependency in test-gnc-option-scheme-output.
Created by using std::to_string() in GncOptionRangeValue::serialize.
It wraps sprintf that reads the locale. Use ostringstream instead.
2023-03-02 12:22:55 -08:00
Christopher Lam
76014f18a0 [account.cpp] don't cache char* [fails] 2023-03-01 23:58:22 +08:00
Christopher Lam
3d381eb6fd [gnc-lot] don't cache char* 2023-03-01 19:49:33 +08:00
Christopher Lam
50f998fad8 [gncInvoice] don't cache char* 2023-03-01 19:49:27 +08:00
Christopher Lam
c9dc71978b [gnc-commodity] don't cache char* 2023-03-01 19:49:20 +08:00
Christopher Lam
57fcaabd8f [Split.c] don't cache char* 2023-03-01 19:49:04 +08:00
Richard Cohen
be41bde58a Add missing MAKE_LINKS, and the local scm directory to %load-path
Before this change, "make check" would fail after
  rm -rf ${build}/share/guile/site/*/gnucash/
2023-02-28 11:51:23 +00:00