There is some inconsistency with the wording of the invoice menu
entries when say a bill is displayed, like 'Jump to Invoice' when it
would be 'Jump to Bill'. Whilst looking at this, further places where
this could be a problem was highlighted so this commit changes entries
to 'Business item'.
Change the Import Map Editor to look for the KVP slot
"ofx/associated-income-account" so it can be listed. The account
reference stored is a GUID so add a function to retrieve that so the
existing gnc_account_delete_map_entry function can be used to remove it.
Add NULL guards before dereferencing return values from GLib calls to prevent
segmentation faults when GSettings schemas are missing (e.g., in library-only builds).
The crash occurred when g_settings_schema_source_get_default() returned NULL
and was passed directly to g_settings_schema_source_lookup(), causing a NULL
pointer dereference. The existing G_IS_SETTINGS check came too late.
Changes:
- Add NULL check for schema_source before using it
- Add NULL check for schema before calling g_settings_new_full()
- Add NULL guard in gnc_settings_dump_schema_paths() for consistency
- All callers already handle NULL returns via G_IS_SETTINGS checks
Fixes: https://bugs.gnucash.org/show_bug.cgi?id=799740https://claude.ai/code/session_01Cdnp3XkAQ29hG1eCxUSAUw
Fix double delete in qof_instance_kvp_remove_guid and remove vestigial glist support.
In the KvpValue::Type::FRAME case if the guid matches, it does both:
delete inst->kvp_data->set_path({path}, nullptr);
delete v;
Where earlier the v was set to be:
auto v = inst->kvp_data->get_slot({path});
The second delete is a duplicate of the first and should be removed.
The collection_compare_cb function set the user_data pointer to point to a local variable
of the function. That pointer is then used in the (only) calling function
qof_collection_compare to make decisions. This is undefined. It is likely not an actual
problem because the stack depth of the qof_collection_foreach followed by
collection_compare_cb is deeper than the qof_collection_get_data call (and others
in between if any) that the stack data user data stays uncorrupted.
But, it is undefined behavior, and could cause really subtle bugs if these there are code
changes that have deeper stack between the setting and using.
Also, using this local variable is not necessary, the qof_collection_compare function
already sets up a variable local to its scope for this that the collection_compare_cb can
use directly.
This commit removes the local (to collection_compare_cb) variable and uses the one setup
in qof_collection_compare.
The full coverage test for qofid.cpp passed before and after this change.
NOTE: This does not have full coverage because the "if (!target || !ent)" body in the
collection_compare_cp function cannot be reached. There is too much safety in the rest of
the system to test this error.
NOTE: I made this a separate test from the test-engine so that I was able to check that it
by itself could test the full coverage of the qofid.cpp file. If it was part of the larger
test, I could have missed some parts that were covered incidentally elsewhere.
Boost::date_time has changed to throwing a std::out_of_range instead of a
boost::date_time::gregorian::bad_year when a date is outside of the
1400-9999 year range it can deal with.
We also recently discovered that it will use the system localtime function
when creating a new date which can lead to a 2038 failure. Use std::chrono
to resolve that problem.
* apply_xmlnode_text (node, f, optional default_val)
retrieves text; and calls and returns f(text)
on failure (i.e. node==null || node has no text), it returns default_val
* apply_xmlnode_text (node, obj, f)
retrieves text; and calls and returns f(obj, text)
on success, it will return true, on failure it returns false
Avoids allocating/g_free temporary strings when DOM text
exists. Replaces dom_tree_to_text() with dom_node_to_text() fast-path
for Account, Transaction, and Split string setters.