gnucash unstable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Thu Oct 26 15:39:14 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/a3003043 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/47460546 (commit)
	from  https://github.com/Gnucash/gnucash/commit/df8ceadb (commit)



commit a3003043540daa9e6f03fa248c7adc2fff908f61
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Oct 26 12:38:50 2017 -0700

    Fix Windows crash-on-throw.
    
    Thanks to https://stackoverflow.com/questions/46688200/mixing-c-and-c-causing-exceptions-to-terminate

commit 47460546355baaf511940d2cdc9367465e239470
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Oct 22 21:58:07 2017 -0700

    Partial fix to exception crashes on Windows.
    
    There seems to be more than one problem that causes the exception handler ("catch") to
    get lost on Windows:
    * Throwing from a constructor called from a member function of another object of the same
    class. That's fixed here for the GncNumeric string constructor, but there's at least one other
    instance I'm still working on in GncNumeric::to_decimal.
    * Hidden memory allocation in a stack-allocated object like std::string, std::istringstream,
    or boost::smatch: The throw causes the object to go out of scope which calls its destructor
    and in that case the catch reference is either lost or never compiled in.
    
    This change ifdefs out the creation of detailed exception messages on Windows to avoid
    the destruction of the std::istringstream and its attached std::string, creates a series of
    helper functions to ensure that the boost::smatch is in a non-throwing scope, and puts the
    computed values directly into the member variables instead of delegating the construction
    to a temporary and then copying out the values. The last item is more correct anyway, as
    C++ constructor delegation is supposed to happen in the member initialization part rather
    than the function body.
    With these changes the exceptions from the GncNumeric string constructor are handled
    correctly.



Summary of changes:
 CMakeLists.txt                    |   2 +-
 libgnucash/engine/gnc-numeric.cpp | 184 ++++++++++++++++++++++++++------------
 2 files changed, 129 insertions(+), 57 deletions(-)



More information about the gnucash-patches mailing list