Changes between Initial Version and Version 1 of Ticket #5303


Ignore:
Timestamp:
Jan 4, 2014, 11:44:07 AM (10 years ago)
Author:
akhliustov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5303

    • Property Summary Cleanup order in gcore/gdaldllmain.cppCleanup completeness in GDALDestroyDriverManager and OGRCleanupAll
  • Ticket #5303 – Description

    initial v1  
    1 GDALDestroyDriverManager() is called before OGRCleanupAll(), but the former does more thorough cleanup of CPL and GDAL resources. They should be called in reverse order.
     11. In supplied global destruction functions ''GDALDestroy'' and ''DllMain'' ''GDALDestroyDriverManager'' is called before ''OGRCleanupAll'' (http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldllmain.cpp#L80; http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldllmain.cpp#L119).
     2The former calls a bunch of cleanup functions ending with ''CPLCleanupMasterMutex'' (http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldrivermanager.cpp#L286).
     3Unfortunately, ''OGRCleanupAll'' immediately tries to get another mutex, recreating the master mutex (http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp#L145).
     4
     52. There a is possibility that ''CPLCleanupMasterMutex'' will not be called at all, if ''GDALDriverManager'' is not instantiated (http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldrivermanager.cpp#L828).
     6
     7These issues can be fixed by adding required calls to ''OGRCleanupAll''.