File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,16 @@ QgsApplication::~QgsApplication()
306
306
delete mApplicationMembers ;
307
307
delete mQgisTranslator ;
308
308
delete mQtTranslator ;
309
+
310
+ // invalidate coordinate cache while the PROJ context held by the thread-locale
311
+ // QgsProjContextStore object is still alive. Otherwise if this later object
312
+ // is destroyed before the static variables of the cache, we might use freed memory.
313
+
314
+ // we do this here as well as in exitQgis() -- it's safe to call as often as we want,
315
+ // and there's just a *chance* that in between an exitQgis call and this destructor
316
+ // something else's destructor has caused a new entry in the caches...
317
+ QgsCoordinateTransform::invalidateCache ();
318
+ QgsCoordinateReferenceSystem::invalidateCache ();
309
319
}
310
320
311
321
QgsApplication *QgsApplication::instance ()
@@ -1190,6 +1200,7 @@ void QgsApplication::exitQgis()
1190
1200
// QgsProjContextStore object is still alive. Otherwise if this later object
1191
1201
// is destroyed before the static variables of the cache, we might use freed memory.
1192
1202
QgsCoordinateTransform::invalidateCache ();
1203
+ QgsCoordinateReferenceSystem::invalidateCache ();
1193
1204
1194
1205
QgsStyle::cleanDefaultStyle ();
1195
1206
You can’t perform that action at this time.
0 commit comments