File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -186,18 +186,15 @@ bool OGRSQLiteBaseDataSource::InitSpatialite()
186186
187187void OGRSQLiteBaseDataSource::FinishSpatialite ()
188188{
189+ // Current implementation of spatialite_cleanup_ex() (as of libspatialite 5.1)
190+ // is not re-entrant due to the use of xmlCleanupParser()
191+ // Cf https://groups.google.com/g/spatialite-users/c/tsfZ_GDrRKs/m/aj-Dt4xoBQAJ?utm_medium=email&utm_source=footer
192+ static std::mutex oCleanupMutex;
193+ std::lock_guard oLock (oCleanupMutex);
194+
189195 if (hSpatialiteCtxt != nullptr )
190196 {
191- auto ctxt = hSpatialiteCtxt;
192- {
193- // Current implementation of spatialite_cleanup_ex() (as of libspatialite 5.1)
194- // is not re-entrant due to the use of xmlCleanupParser()
195- // Cf https://groups.google.com/g/spatialite-users/c/tsfZ_GDrRKs/m/aj-Dt4xoBQAJ?utm_medium=email&utm_source=footer
196- static std::mutex oCleanupMutex;
197- std::lock_guard oLock (oCleanupMutex);
198- pfn_spatialite_cleanup_ex (ctxt);
199- }
200- // coverity[thread1_overwrites_value_in_field]
197+ pfn_spatialite_cleanup_ex (hSpatialiteCtxt);
201198 hSpatialiteCtxt = nullptr ;
202199 }
203200}
You can’t perform that action at this time.
0 commit comments