gnucash master: Bug 798778 - GnuCashquits abruptly when attempting to edit options…
John Ralls
jralls at code.gnucash.org
Fri Mar 17 13:42:31 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/b4b84319 (commit)
from https://github.com/Gnucash/gnucash/commit/144b6ae0 (commit)
commit b4b843198421aef9332ad1cae348a4acacfa5586
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Mar 16 17:50:06 2023 -0700
Bug 798778 - GnuCashquits abruptly when attempting to edit options…
for certain reports.
Those reports being ones using complex options, apparently because
the callbacks weren't protected from Guile's garbage collector.
So replace the anyway ugly hack of a void* with a std::any wrapping
a class holding a std::unique_ptr with a custom deleter. The
constructor calls scm_gc_protect_object on the SCM containing the
callback and the custom deleter calls scm_gc_unprotect_object. The
copy constructor, required for std::any, makes a new std::unique_ptr
and calls scm_gc_protect_object again ensuring that the protect and
unprotect calls are symmetrical.
Meanwhile std::any hides the Guile dependency from all the classes
that don't need to know about it. The only ugliness is that there's
no good place to put a common implementation of SCNCallbackWrapper so it's
repeated in gnc-optiondb.i and dialog-options.cpp.
Summary of changes:
bindings/guile/gnc-optiondb.i | 24 ++++++++++++++++++++++--
gnucash/gnome-utils/dialog-options.cpp | 30 ++++++++++++++++++++++++++----
libgnucash/engine/gnc-option.hpp | 9 +++++----
3 files changed, 53 insertions(+), 10 deletions(-)
More information about the gnucash-patches
mailing list