FileSystemWatcher: Prevent double-delete of static data

If any static data directly or indirectly holds a FileSystemWatcher,
destruction of that data competes with the destruction of
FileSystemWatcher's static data. Prevent this by guarding the access to
said static data in FileSystemWatcher's destructor.

Change-Id: I4def4cab36583249b0c512387e57400f532b6709
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2018-12-13 14:32:46 +01:00
parent 0ea3346d68
commit e3026623a3

View File

@@ -206,7 +206,7 @@ FileSystemWatcher::~FileSystemWatcher()
if (!d->m_directories.isEmpty())
removeDirectories(directories());
if (--(d->m_staticData->m_objectCount) == 0) {
if (!fileSystemWatcherStaticDataMap.isDestroyed() && --(d->m_staticData->m_objectCount) == 0) {
delete d->m_staticData->m_watcher;
d->m_staticData->m_watcher = nullptr;
d->m_staticData->m_fileCount.clear();