[GNC-dev] Tax Tables

John Ralls jralls at ceridwen.us
Mon Aug 26 13:06:08 EDT 2019



> On Aug 26, 2019, at 4:38 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> 
> Hi,
> 
> I got distracted with these warning in my trace file as I like to build/run
> with an empty one so I know any errors are down to me, these are from an
> XML file with one open invoice when saving...
> 
> * 11:58:50  WARN <gnc.io> [taxtable_reset_refcount()] Fixing refcount on
> taxtable 2dca815fad04436cbb5497517803cc79 (2 -> 1)
> * 11:58:56 ERROR <gnc.backend.xml> xmlNode* time64_to_dom_tree(const char*,
> time64): assertion 'time != INT64_MAX' failed
> * 11:58:56 ERROR <gnc.backend.xml> xmlNode* time64_to_dom_tree(const char*,
> time64): assertion 'time != INT64_MAX' failed
> * 11:58:56 ERROR <gnc.backend.xml> xmlNode* time64_to_dom_tree(const char*,
> time64): assertion 'time != INT64_MAX' failed
> * 11:58:56 ERROR <gnc.backend.xml> xmlNode* time64_to_dom_tree(const char*,
> time64): assertion 'time != INT64_MAX' failed
> * 11:58:56 ERROR <gnc.backend.xml> xmlNode* time64_to_dom_tree(const char*,
> time64): assertion 'time != INT64_MAX' failed
> 
> taking the time64 errors first, I was going to propose changing
> maybe_add_time64 in gnc-invoice-xml-v2.cpp as follows...
> 
>    if (time)
> to
>   if (time && time != INT64_MAX)
>        xmlAddChild (ptr, time64_to_dom_tree (tag, time));
> 
> any one see a problem with that ?

0 is a perfectly valid time64, representing 1970-01-01 00:00:00 UTC. Just check that it's not INT64_MAX.
> 
> Now the first warning, this is due to the blank ledger entry in the open
> invoice having the tax table cell filled in with the default one for that
> customer and when one quits Gnucash the file save happens before the gui is
> destroyed so the refcount will always be wrong by the number of open
> invoices.
> I did think about decreasing the refcount for the table in the blank entry
> but that causes another issue with the value going below 0 unless it could
> be increased before the ledger is destroyed.
> 
> Can any one else see a way of fixing this, maybe just change it to an info
> message ?
> 
> On a similar note, if you save the file as a sqlite3 one, the refcount will
> increase on every save / open by the number of open invoices which is down
> to new entries with the default tax table being added to the 'entries
> table' which also do not have an invoice value.
> 
> No clue on this one.

The SQL backend doesn't scrub the refcount which is why it's increasing.

It's not at all clear to me that the taxtable refcount serves any useful purpose, but if it does it shouldn't be incremented in the blank entry. It should only be incremented when a new GncEntry or GncOwner referencing it is committed.

Regards,
John Ralls



More information about the gnucash-devel mailing list