diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-05-24 20:50:32 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-06-01 09:34:33 +0000 |
commit | 1ddfb443b686ef04cc0e28363308ce70d01f0d73 (patch) | |
tree | 2bcebca79e402ddf5b87b0cb2f1e9dbb4f96464e /src/shared/proparser/qmakeparser.cpp | |
parent | 760a63293673271b74fdeac3d574f6113975078f (diff) |
qmake: fix file id mapping lifetime management, take 2v4.6.2
turns out that ref-counting the vfs class is insufficient, as now the
ProFile cache (which expires after a timeout) could outlive all VFS
instances and thus refer to ids which were discarded and later re-used.
to avoid this, we let the cache instance hold a reference to the vfs
class.
amends d03fb3506.
Task-number: QTCREATORBUG-20524
Change-Id: Idd4478ffc1c2405b3b83df32fba45b1f687f6a18
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/shared/proparser/qmakeparser.cpp')
-rw-r--r-- | src/shared/proparser/qmakeparser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 6b0ae22e83..8d6ef622fd 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -42,11 +42,17 @@ QT_BEGIN_NAMESPACE // /////////////////////////////////////////////////////////////////////// +ProFileCache::ProFileCache() +{ + QMakeVfs::ref(); +} + ProFileCache::~ProFileCache() { foreach (const Entry &ent, parsed_files) if (ent.pro) ent.pro->deref(); + QMakeVfs::deref(); } void ProFileCache::discardFile(const QString &fileName, QMakeVfs *vfs) |