You shouldn't throw C++ exceptions, as this is a callback of the C API. This will cause all sort of issues, most of the time memory leaks, etc.

Le 05/12/2021 à 00:49, Simon Eves a écrit :
We have a custom Error Handler callback and for a while now it was configured to throw an exception if the class was Failure or higher.

Unfortunately, we have found that this causes havoc with OpenEx() because the file management state is left bad (e.g. the anti-recursion stuff) and GDAL will believe the file is open when it isn't, and other such hilarity.

We have changed this to disable and re-enable the exception throw (and just log the error) either side of an OpenEx() but I am concerned that there are perhaps other situations where throwing may cause similar issues.

The docs for CPLSetErrorHandler() don't explicitly say anything about not throwing in the callback.

Please advise.

SE

--
<http://www.omnisci.com/>
        
Simon Eves
Senior Graphics Engineer, Rendering Group
100 Montgomery St (5th Floor), San Francisco, CA 94104, USA


        
Email: [email protected] <mailto:[email protected]> | Cell: +1 (415) 902-1996




_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.

_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to