[gdal-dev] Call to GDALDestroy results in occasional core dump, GDAL 3.4.2
Andrew Bell
andrew.bell.ia at gmail.com
Wed Sep 18 17:50:28 PDT 2024
On Wed, Sep 18, 2024 at 8:32 PM Fox, Shawn D (US) via gdal-dev <
gdal-dev at 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.ia at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240918/452881b0/attachment.htm>
More information about the gdal-dev
mailing list