mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
b4b8431984
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. |
||
---|---|---|
.. | ||
test | ||
app-utils.scm | ||
business-core.scm | ||
c-interface.scm | ||
CMakeLists.txt | ||
core-utils.scm | ||
date-utilities.scm | ||
engine.scm | ||
expressions.i | ||
fin.scm | ||
glib-guile.c | ||
glib-guile.h | ||
gnc-engine-guile.cpp | ||
gnc-engine-guile.h | ||
gnc-guile-bindings.c | ||
gnc-guile-utils.c | ||
gnc-guile-utils.h | ||
gnc-helpers.c | ||
gnc-helpers.h | ||
gnc-kvp-guile.cpp | ||
gnc-kvp-guile.h | ||
gnc-numeric.scm | ||
gnc-optiondb.i | ||
options.scm | ||
utilities.scm |