[GNC-dev] gnucash maint: Multiple changes pushed

John Ralls jralls at ceridwen.us
Thu Jan 10 21:26:27 EST 2019



> On Jan 10, 2019, at 5:25 PM, Derek Atkins <derek at ihtfp.com> wrote:
> 
> 
> On Thu, January 10, 2019 7:42 pm, John Ralls wrote:
>> 
> [snip]
>> 
>> Gtk has gtk_init. You call it, set up your GUI, then call gtk_main to
>> start the event loop. libguile has several initialization functions to
>> choose from:
>> https://www.gnu.org/software/guile/manual/html_node/Initialization.html#Initialization.
>> No "initialize on first use" there.
>> 
>> Consider that "initialize on first use" means that *every* exported
>> function has to have a clause or belong to a class whose constructor
>> checks for and initializes the global state. If we just need to do it for
>> localizing the C++ UI locale, that's what get_cpp_locale() does and we're
>> done, except that we'd have to make that first call thread safe. If we
>> need to do much more, a library init function is cleaner and simpler...
>> and might be cleaner and simpler than making get_cpp_locale thread safe.
>> 
>> This is all for the rather distant future, though, so let's defer figuring
>> it out til then. We'll forget by then anything we decide now. ;-)
> 
> Add a comment in the code to remind us?

There's nothing special about it. GnuCash is written in a way that pretty much everything except function local variables is global thanks to QofContainer. Transactions are lightly protected in the obvious case where one might try to edit the same one in two registers, but that's about it. qof_begin_edit/qof_commit_edit afford no protection at all... quite the opposite, in fact.

Regards,
John Ralls



More information about the gnucash-devel mailing list