mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-29 12:14:31 -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. |
||
---|---|---|
.. | ||
app-utils | ||
backend | ||
core-utils | ||
doc | ||
engine | ||
gnc-module | ||
quotes | ||
tax | ||
CMakeLists.txt |