==515314== Invalid read of size 1
==515314== at 0x484AD67: __strcmp_sse42 (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x171D36: do_test_list_handler (unittest-support.c:181)
==515314== by 0x171DCE: test_list_handler (unittest-support.c:197)
==515314== by 0x51BD4C1: g_logv (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51BD7A2: g_log (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4D5D0D9: xaccSplitEqualCheckBal (Split.c:753)
==515314== by 0x4D5D841: xaccSplitEqual (Split.c:869)
==515314== by 0x4D647A5: xaccTransEqual (Transaction.c:981)
==515314== by 0x15C0E8: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:901)
...
==515314== Address 0x8725260 is 0 bytes inside a block of size 59 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x15BDB1: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:883)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x5618677: __vasprintf_internal (vasprintf.c:116)
==515314== by 0x520E8C1: g_vasprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBBE0: g_strdup_vprintf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51DBC9C: g_strdup_printf (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x15BBAC: test_xaccTransEqual(Fixture*, void const*) (utest-Transaction.cpp:879)
...
ok 78 /engine/Transaction/xaccTransEqual
Thanks, Valgrind:
==515314== Invalid read of size 8
==515314== at 0x4ED46F3: gncInvoiceRemoveEntries (gncInvoice.c:767)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Address 0x8557b98 is 8 bytes inside a block of size 24 free'd
==515314== at 0x484620F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51B565D: g_list_remove (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED42EF: gncInvoiceRemoveEntry (gncInvoice.c:688)
==515314== by 0x4ED46A2: gncInvoiceRemoveEntries (gncInvoice.c:781)
==515314== by 0x142B35: teardown_with_invoice (utest-Invoice.c:274)
...
==515314== Block was alloc'd at
==515314== at 0x4843828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==515314== by 0x51BD948: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x51B1CB9: ??? (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7600.1)
==515314== by 0x4ED4271: gncInvoiceAddEntry (gncInvoice.c:676)
==515314== by 0x142401: setup_with_invoice (utest-Invoice.c:142)
...
ok 57 /engine/gncInvoice/post trans - vendor bill
The test relies on a lot of external dependencies
- installed finance-quote-wrapper
- alpha vantage key
- network
- working remote server
Running ./bin/test-gnc-quotes from the command line
will still include online_wiggle
Pass a boost::filesystem's c_str() rv to the ofstream constructor to
keep libstdc++ from transcoding it back to UTF8 and creating a broken
name or failing to match the directory name. Implemented in
gnc-filepath-utils to avoid spreading the boost::filesystem dependency
throughout the code base.
See https://github.com/boostorg/filesystem/issues/181 for why other
approaches don't work.
When the commodity table is registered, the current book will get
a default table assigned. When later setting the table explicitly
using qof_book_set_data() the exisiting table gets overwritten and
is thus leaked.
There is no way of removing or freeing a currency table from a book,
so the best we can do here is to set our own table on the book before
calling gnc_commodity_table_register().
If a function that returns an allocated pointer is passed directly into
something that does not take ownership of the pointer, the allocation is
leaked. This can be fixed by assigning the pointer to a new variable
and freeing it after operation on the memory.
At least one user has managed to get it set on their book so even
though it was supposed to be unimplemented it got through somehow.
Restoring it allows books with it set to load.
- 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.
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.
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.
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.
This fixes memory leaks that are only present in testing code.
Not very useful on itself, but it does make it easier to fix memory
leaks and other AddressSanitizer problems in actual gnucash code later.
These were not used outside a test.
And that test was not leak free, as a result of the functions not doing
what they are supposed to do when the current value is not of the type
that is expected. (NULL is returned, but the value is not replaced)
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.
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
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 ..."
- 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
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.
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.
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.
reverse transaction.
The proximate cause was that xaccTransBeginEdit put the KVP cache
variable of the new transaction in a state that prevented the value
from being copied. More generally the KVP cache variables didn't
handle any invalidating events.
With the change to GValue usage in qof_instance_get_kvp it's now
a simple memory dereference with no copying except for POD types
so caching is no longer useful. This commit removes caching from
Transaction, eliminating the notes problem.
Enable and fix the previously untested GtkOptionGtkUIItem::PLOTSIZE.
This has the potentially unfortunate side effect that integer range
options are assumed to be plot sizes. That's correct for now, but
if some report comes along that needs an integer range option for
something else it will have to be differentiated.
Expose variations of xaccParseAmount and
xaccParseAmountExtended that will ignore the
automatic decimal point user preference.
This preference is really only useful for manual number
entering in the register.
The xaccParseAmountImport variant replaces xaccParseAmountPosSign
which was used exclusively by the csv importers.
Like xaccParseAmountPosSign, this replacement has the flag
to ignore or parse the positive number indicator.
GLib 2.76 introduced a no-discard warning on g_string_free
if the second parameter is FALSE. This revealed a string
leak and a correct usage that didn't use the return value.
Use ref-counting to manage GSettings object lifecycle
Use g_signal_handler_handlers_[un]block_matched to
block or unblock handlers rather than tracking them in
our own hash table.
Most getters and setters are identical with the exception of
the actual function to call into GSettings. Extract
boilerplate in two template functions and make all
getters/setters wrappers of these two functions.
Only cache GSettings objects we need to keep
track of callback functions.
This means a bit more overhead per GSettings
interaction, but as typical interactions are
only a few objects at once at best, this
overhead is unnoticeable.
In file included from gnucash/gnome-utils/dialog-options.cpp:34:
gnucash/gnome-utils/dialog-options.hpp:55:10: warning: private field 'toplevel' is not used [-Wunused-private-field]
bool toplevel;
^
In file included from gnucash/import-export/csv-imp/gnc-imp-props-price.cpp:42:
gnucash/import-export/csv-imp/gnc-imp-props-price.hpp:113:10: warning: private field 'created' is not used [-Wunused-private-field]
bool created = false;
^
libgnucash/backend/dbi/gnc-dbisqlconnection.cpp:53:29: warning: private field 'm_conn' is not used [-Wunused-private-field]
const GncSqlConnection* m_conn = nullptr;
^
libgnucash/backend/sql/test/utest-gnc-backend-sql.cpp:81:33: warning: private field 'm_conn' is not used [-Wunused-private-field]
const GncMockSqlConnection* m_conn;
^
libgnucash/engine/test/utest-Account.cpp:2414:11: warning: typedef ‘using AcctTypeType = struct std::underlying_type<GNCAccountType>’ locally defined but not used [-Wunused-local-typedefs]
2414 | using AcctTypeType = std::underlying_type<GNCAccountType>;
| ^~~~~~~~~~~~
borrowed/jenny/jenny.c: In function ‘next_builder’:
borrowed/jenny/jenny.c:1164:5: warning: statement with no effect [-Wunused-value]
1164 | for (i; i<n-1; ++i) { /* reset all less significant positions */
| ^~~
borrowed/jenny/jenny.c:1172:5: warning: statement with no effect [-Wunused-value]
1172 | for (i; i<n-1; ++i) { /* reset all less significant positions */
| ^~~
borrowed/jenny/jenny.c: In function ‘confirm’:
borrowed/jenny/jenny.c:1797:7: warning: statement with no effect [-Wunused-value]
1797 | for (i; i<n-1; ++i) { /* reset all less significant positions */
| ^~~
borrowed/jenny/jenny.c:1805:7: warning: statement with no effect [-Wunused-value]
1805 | for (i; i<n-1; ++i) { /* reset all less significant positions */
| ^~~
libgnucash/backend/xml/io-gncxml-v2.cpp: In function ‘gboolean qof_session_load_from_xml_file_v2_full(GncXmlBackend*, QofBook*, sixtp_push_handler, gpointer, QofBookFileType)’:
libgnucash/backend/xml/io-gncxml-v2.cpp:806:40: warning: value computed is not used [-Wunused-value]
806 | g_thread_join (thread) != nullptr;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp: In function ‘void xaccFreeAccount(Account*)’:
libgnucash/engine/Account.cpp:1428:17: warning: statement has no effect [-Wunused-value]
1428 | priv->color == nullptr;
| ~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1429:22: warning: statement has no effect [-Wunused-value]
1429 | priv->sort_order == nullptr;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1430:17: warning: statement has no effect [-Wunused-value]
1430 | priv->notes == nullptr;
| ~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/Account.cpp:1431:18: warning: statement has no effect [-Wunused-value]
1431 | priv->filter == nullptr;
| ~~~~~~~~~~~~~^~~~~~~~~~
libgnucash/engine/gnc-int128.cpp: In function ‘void decimal_from_binary(uint64_t*, uint64_t, uint64_t)’:
libgnucash/engine/gnc-int128.cpp:898:36: warning: right operand of comma operator has no effect [-Wunused-value]
898 | d[3] = (hi >> 32) & bin_mask, 0;
| ^
Behaviour is as follows:
If
single line provides a price
And
at some point in the import process we get into a
situation where the base account and transfer
account have a different commodity
Then
transfer_acct amount = base_acct amount * price
If on the other hand base_acct and transfer_acct turn
out to have the same commodity, price is ignored.
There is no added value in storing the book and account together
The book is easily retrieved from the account (as was
illustrated in the gnc_account_imap_new function).
I looked through the commit history to understand why this struct
was originally created and a long time ago it also had
a reference to a kvp frame.
This change was inspired by mildred's #PR1247 and uses the new
GncReportCombo to allow selection of 'Saved Invoice reports' when the
invoice print button is used or when printing multiple invoices.
This change presents a dialog with the default for the report combo set
to the properties setting. This dialog has a timeout which is
adjustable under properties and will stop if a key is pressed or combo
popped so that a different report template can be selected and used.
There is also an 'OK' button that stops the time out and prints and a
'Cancel' button which cancels the print.
This commit changes the preference in Business->'Report for Printing'
to be saved as a book property and allow the selection of any Invoice
Report to be used as the default.
- Show proper amount in dialog when applying or editing an existing transaction as payment
- Be more careful not to waste the existing payment split
- If the user changed the payment amount while starting from an existing transaction
unreconcile the changed payment split
- Avoid needlessly changing transaction currency (only do so if the user chose
a new transfer account and the old currency is neither the new transfer account's
currency nor the post account's currency)