octave.cxx: fix exception raising for newer Octave versions
- Since (at least) Octave 5.1.0, the Octave error() function now raises a C++
exception, which if uncaught immediately exits a SWIG wrapper function,
bypassing any cleanup code that may appear after a "fail:" label.
- This patch adds a "try { ... } catch(...) { }" block around the contents of
SWIG wrapper functions to first execute the cleanup code before rethrowing any
exception raised.
- It is backward compatible with earlier versions of Octave where error() does
not raise an exception, which will still branch to the "fail:" block to
execute cleanup code if an error is encountered.
2 files changed