[R] Run destructors of local C++ objects on SWIG_fail

Arrange that destructors of local C++ objects in the wrapper function
get run on SWIG_fail (which calls Rf_error() which calls longjmp()).

We achieve this by putting almost everything in the function in its
own block, and end that right before Rf_error() at which point those
destructors will get called.
This commit is contained in:
Olly Betts 2022-10-14 13:18:56 +13:00 • committed by Olly Betts
commit 5f96d15943
3 changed files with 25 additions and 1 deletions

View file

@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.1.0 (in progress)
===========================
2022-10-14: olly
[R] Arrange that destructors of local C++ objects in the wrapper
function get run on SWIG_fail (which calls Rf_error() which calls
longjmp()).
2022-10-14: olly
[Lua] Arrange that destructors of local C++ objects in the wrapper
function get run on SWIG_fail (which calls lua_error() which calls