Re: [Rd] calling R API functions after engine shutdown

2017-10-02 Thread Lukas Stadler
If this is not considered to be safe, then I guess my message can be seen as a heads-up: If R_ReleaseObject ever does something that is not safe after the R engine has shut down, you will start to see crashes from packages like “minqa”. In FastR, we ended up adding a global flag that disables

Re: [Rd] calling R API functions after engine shutdown

2017-09-21 Thread Tomas Kalibera
Calling R_ReleaseObject in a C++ destructor is not reliable - it can be bypassed by a non-local return, such as an error. Generally in R one cannot use C++ destructors reliably for anything that the R runtime wouldn't do on its own in case of a non-local return. A destructor that calls just

[Rd] calling R API functions after engine shutdown

2017-09-21 Thread Lukas Stadler
Hi! We’ve recently come across an example where a package (minqa) creates an Rcpp Function object in a static variable. This causes R_ReleaseObject to be called by the destructor at a very late point in time - as part of the system exit function: static Function cf("c"); I’m wondering if that