On Wed, Sep 18, 2024 at 8:32 PM Fox, Shawn D (US) via gdal-dev <
gdal-dev@lists.osgeo.org> wrote:

> In our case we have a singleton class that acts as a façade and all of our
> calls to GDAL Apis are done by the methods of this class.  The rest of our
> code base only interacts with the singleton so that we only have one
> project that actually depends directly on the GDAL library.  Since the
> _instance member is a static smart pointer the destructor of our class and
> the GDALDestroy function is being called after the main function exits.
>

This is not a great plan unless you understand exactly the order of things
being destroyed, which is not well-defined between compilation units unless
you have done things to guarantee it. It seems likely that GDALDestroy() is
attempting to free things already destroyed during program tear-down. Since
your program is exiting, I can't imagine you need to call GDALDestroy() at
all.  You could also eliminate this issue by instantiating your GDAL
class-thingee as the first line of your program rather than as a static.

-- 
Andrew Bell
andrew.bell...@gmail.com
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to