Commit Graph

460 Commits

Author SHA1 Message Date
John Ralls
26a179872d Don't create 2 new books for every new session.
And don't ask to save a not-dirty or empty book, fixing
Bug 794870 - If no book is opened, gnucash still asks if the user wants
to save changes when opening a file
2018-09-23 16:42:11 -07:00
Geert Janssens
3991ccb9c2 Cache current owner balances
These are queried continuously by the owner tree view (on Customer/Vendor/Employee
Overview pages) and recalculating them is an expensive operation.
The cache will be invalidated each time a lot reated to the owner
changes (modify or delete). The net effect is a huge responsiveness
improvement of said overviews in case of a large book.
2018-09-23 16:00:41 +02:00
John Ralls
40bcd1e377 Bump the max_denom_mult to match the new GNC_COMMODITY_MAX_FRACTION. 2018-09-21 14:33:02 -07:00
John Ralls
4fe12f5422 Some more magic number replacements. 2018-09-21 14:32:03 -07:00
John Ralls
87533fe4bc Catch std::underflow_error as well as std::overflow_error.
Any operation that can overflow will throw an underflow if it's a
negative number. The C interface needs to catch both to prevent
unhandled exception crashes,
2018-09-21 14:28:49 -07:00
John Ralls
6d2ef90313 Fix a magic number. 2018-09-21 13:00:34 -07:00
John Ralls
dd10ac8bc7 Don't need NANOS_PER_SECOND anymore. 2018-09-21 13:00:19 -07:00
John Ralls
80a4591736 Bug 786708 - GnuCash won't load currency fractions larger than 1000000.
Also create larger fractions for the account dialog.
2018-09-21 12:59:50 -07:00
John Ralls
2d565215cd Fix localedir relocation.
Since LOCALEDIR is now always absolute we need to see if there's a
prefix and if LOCALEDIR is a subdir of PREFIX instead.
2018-09-18 16:08:48 -07:00
John Ralls
83b1b8adfc Fix typos. 2018-09-16 13:05:49 -07:00
John Ralls
162605f505 Fix Windows binreloc executable finding.
Taking into account the behavior of
g_win32_get_package_installation_directory_of_module when the last
directory element either is or isn't "bin".
2018-09-16 12:36:04 -07:00
Geert Janssens
5057703d30 Sql backend - show progress similar to how it's done for xml backend
That is let the percentage increase gradually. The current granularity is still
very rough, but at least it gives an indication of getting closer to fully
loading the data. The previous configuration on the other hand only suggested
something was happening but with no indication where in the load process
gnucash was.
2018-09-15 17:48:37 +02:00
Geert Janssens
5775662b52 Raise edit level of all accounts before loading transactions and splits
This prevents calling xaccAccountRecomputeBalanceInCurrency on each split that gets added,
which was exponentially increasing load times. On a huge test book the
load time dropped from 53 minutes to 1m20s.
2018-09-15 17:05:16 +02:00
Geert Janssens
221c46585c Sql backend - load transactions before business objects to reduce individual slot queries 2018-09-15 16:38:55 +02:00
Geert Janssens
62eb95c05c Fix memory leaks in gncOwnerGetBalanceInCurrency 2018-09-14 11:34:45 +02:00
Geert Janssens
4e71629966 Fix memory leak in xaccTransRetDateDue 2018-09-14 10:47:31 +02:00
John Ralls
10a21cbfac Merge branch 'Bug794526' into maint 2018-09-11 10:46:02 -07:00
Geert Janssens
48b29f5e91 Fix memory leak in char* type KvpValue and fix improper uses
The core issue was that the delete visitor was never called because its parameter
type (char *) didn't match the boost::variant type (const char *).
Fixing the visitor's parameter type also require a const_cast
back to char * because that's what g_free takes as argument.

The rest of this commit is merely fixing KvpValue instantiations that
tried to create a char* KvpValue from a stack based const string instead
of a heap allocated one. That would bomb out on calling the
delete visitor.
2018-09-10 19:49:43 +02:00
Geert Janssens
b866d7d955 Plug memory leak in xaccSplitDestroy
Splits were not marked for deletion if the transaction is read-only
and the account is not marked for deletion yet. The net result is
that split will not be freed later on.
However xaccSplitDestroy is also called from a Transaction's do_destroy.
At that point accounts are not necessarily marked for deletion yet (like
is the case when a datafile is closed). This turned out to be a problem
for invoice post transactions (which are also read only) and hence
would cause memory to leak.
2018-09-10 18:57:39 +02:00
Geert Janssens
1117027f72 An empty GValue is interpreted as NULL reason, which is still a valid cache
Ignoring this would make caching almost useless as there are typically
only very few read-only transactions.
2018-09-10 10:24:49 +02:00
John Ralls
f219bc45aa Bug 794526 - Python bindings can't find loadable modules.
Always use absolute paths for configured directories (BINDIR etc.)
Abstract out the guts of gnc_gbr_find_foo_dir for foo in lib, bin, and data.
etc requires special handling because of the way it's treated if prefix
begins with /opt.

Always fall back on the configured directory if binreloc is disabled and
no default is passed in.
2018-09-09 16:36:39 -07:00
John Ralls
a19dcc7bd4 Fix crash when there's no TRANS_READ_ONLY_REASON slot.
Unsetting an empty g_value raises a fatal error, causing tests to fail
in some environments.

g_free() handles NULLs itself, no need to protect it.
2018-09-09 15:02:53 -07:00
Geert Janssens
d069b67d48 Fix memory leak in xaccTransGetReadOnly
In addition implement a cache for this value as suggested in the comments
as this function is called on every transaction commit.
2018-09-09 22:50:05 +02:00
Geert Janssens
3634e8f59d Fix memory leak using qof_instance_get on a GncGUID
The underlying boxed type will return a copy so we should free this
when no longer needed.
2018-09-09 22:50:05 +02:00
Geert Janssens
4cc61463ab Remove unused variable 2018-09-09 22:50:05 +02:00
John Ralls
b05082a09d Merge Chris Lam's consolidated invoice report into maint. 2018-09-08 14:43:33 -07:00
Geert Janssens
705e866472 Bug 796054 follow up
Now that a separate wiki section has been written for the side effects of this bug
make the memo field of affected splits point to this wiki section.
2018-09-01 16:22:42 +02:00
Geert Janssens
d07f759ca3 Use alignment-safe buffer handling
Casting a char* to a struct containing a uint32_t is not universally safe
due to alignment constraints on reads on some platforms. Copy our possibly
unaligned source data into an aligned area of memory to avoid SIGBUS on
armhf.
Reported by vorlonofportland in PR#403. This commit the John's optimized
version of Vorlon's proposed fix.
2018-09-01 12:07:42 +02:00
Geert Janssens
4c87dd05ec Fix compiler warning issues
- add -Wno-deprecated-declarations to CXX_FLAGS as well. This was
  reported by vorlonofportland in PR#401 to become necessary for glib 2.58
  as that has deprecated g_type_class_add_private which appears in our
  c++ code.
- change -Wno-deprecated-register into -Wregister. The former appeared to
  be a clang dialect and alias for the latter (see
  https://github.com/Barro/compiler-warnings for an overview of clang
  and gcc warnings). It was moved to global CXX_FLAGS as it can only be
  added for g++.
2018-09-01 12:07:38 +02:00
Geert Janssens
131df82135 Merge branch 'date-bugs' of https://github.com/Bob-IT/gnucash into maint 2018-08-31 22:01:45 +02:00
Geert Janssens
baf933acf2 Bug 796054 - unposting and reposting invoice doubles amounts
Add scrub function to unblock the double post transaction
2018-08-31 20:24:39 +02:00
John Ralls
fc368b91d2 Restore the timespec_val column name in the slots table.
Renaming it would require a backwards-incompatible schema change,
something that shouldn't happen in the middle of a stable series.
2018-08-30 17:03:41 -07:00
Geert Janssens
c977c2350a Merge branch 'sort-filter' of https://github.com/Bob-IT/gnucash into maint 2018-08-30 12:18:15 +02:00
John Ralls
704afc6e02 Comment to explain structuring an (env-transfer-foreign). 2018-08-28 15:10:29 -07:00
John Ralls
fe73f52bdb Guard against divide-by-zero errors. 2018-08-28 15:10:29 -07:00
Robert Fewell
2dcb316280 White space removal and change tabs to spaces in qofbook.cpp/h 2018-08-25 11:10:32 +01:00
Robert Fewell
fd750a22eb Cache the number of days read only value
The KVP value for the qof_book_get_num_days_autoreadonly was being
called many times so it makes sense to cache it in the book to avoid
the KVP lookup.
2018-08-25 11:10:24 +01:00
Robert Fewell
a650693d07 New feature for register sort/filter settings move. 2018-08-17 11:31:25 +01:00
Robert Fewell
9423e0913b Remove white space and re-indent gnc-features.c 2018-08-17 11:31:25 +01:00
John Ralls
c08dee67ba Preserve timespec-using functions in Guile bindings.
There's an example of use in text-extras.scm, function
gnc-pricedb-create.

Unfortunately the deprecation messages issue no warnings.
2018-08-16 10:47:41 -07:00
John Ralls
e9098d08d2 Change ISO date format to remove fractional seconds. 2018-08-13 16:19:39 -07:00
John Ralls
35fabe2690 Remove Timespec from gnc-date. 2018-08-13 16:19:39 -07:00
John Ralls
20f6e4e690 Remove Timespec from the SQL backend. 2018-08-13 11:52:43 -07:00
John Ralls
755773ac4c Clean up timespec comments in the XML backend.
Noting where the word must stay; most significantly for KVP types and for
parsing Version 1 XML files.
2018-08-13 11:52:43 -07:00
John Ralls
b32a8a9390 Remove time64_to_string and string_to_time64 and their tests.
Each was used exactly once and simply wrapped a function call.
Also replace static function time_parse_failure that just returned a
constant with the constant.
2018-08-13 11:52:43 -07:00
John Ralls
62b17ca5db Timespec removal, engine odds-and-ends. 2018-08-13 11:52:43 -07:00
John Ralls
358cd979d9 Remove Timespec from the main engine classes (Transaction, Split, & Account. 2018-08-13 11:52:42 -07:00
John Ralls
fee589b28c Remove Timespec from pricedb.
Includes removing the time64 specialized functions because the regular ones
handle time64 now.
2018-08-13 11:52:42 -07:00
John Ralls
92a8cf330a Timespec->time64 in business code. 2018-08-13 11:52:42 -07:00
John Ralls
c8b372e390 Convert GNC_TYPE_TIMESPEC to GNC_TYPE_TIME64, Kvp::Type::Timespec to Kvp::Type::Time64
They have to go together because of using gvalues to hide KVP from most of
GnuCash.
2018-08-12 16:12:19 -07:00