summaryrefslogtreecommitdiffstats
path: root/qmake/library/qmakeparser.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <[email protected]>2018-05-24 20:50:32 +0200
committerOswald Buddenhagen <[email protected]>2018-08-24 12:16:37 +0000
commitf12fd482f50fde77f11d3c45309d538c02b9d334 (patch)
tree376a48c5b9e76a6fffae2fd33911596df2b7b346 /qmake/library/qmakeparser.cpp
parent39cb9ac873cc9b6f829238142c1efa11f6a51fda (diff)
qmake: fix file id mapping lifetime management
turns out that flushing the ids together with the ProFile cache was an abysmal idea, as the latter expires after a few seconds after loading the project, while references to the ProFiles (and thus the underlying file ids) are kept for as long as the project stays loaded. the early flush would cause re-use of the file ids, which would wreak all kinds of havoc when re-loading projects. but just ref-counting the vfs class is insufficient as well, as then 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. so we ref-count, and additionally let the cache instance hold a reference to the vfs class. this is sync-up with qt creator; no actual effect on qmake itself. amends 190aa94be. Change-Id: Idd4478ffc1c2405b3b83df32fba45b1f687f6a18 Reviewed-by: Robert Loehning <[email protected]> Reviewed-by: Orgad Shaneh <[email protected]> Reviewed-by: Eike Ziller <[email protected]> Reviewed-by: Tobias Hunger <[email protected]> (cherry picked from qtcreator/d03fb350672d311dccc06f0bcb4da744a3c99745) (cherry picked from qtcreator/1ddfb443b686ef04cc0e28363308ce70d01f0d73) Reviewed-by: Oswald Buddenhagen <[email protected]>
Diffstat (limited to 'qmake/library/qmakeparser.cpp')
-rw-r--r--qmake/library/qmakeparser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp
index 131ec6db6ac..4c8360b4598 100644
--- a/qmake/library/qmakeparser.cpp
+++ b/qmake/library/qmakeparser.cpp
@@ -45,11 +45,17 @@ QT_BEGIN_NAMESPACE
//
///////////////////////////////////////////////////////////////////////
+ProFileCache::ProFileCache()
+{
+ QMakeVfs::ref();
+}
+
ProFileCache::~ProFileCache()
{
for (const Entry &ent : qAsConst(parsed_files))
if (ent.pro)
ent.pro->deref();
+ QMakeVfs::deref();
}
void ProFileCache::discardFile(const QString &fileName, QMakeVfs *vfs)