aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/shared/proparser/qmakeparser.cpp6
-rw-r--r--src/shared/proparser/qmakeparser.h2
-rw-r--r--src/shared/proparser/qmakevfs.cpp13
-rw-r--r--src/shared/proparser/qmakevfs.h3
4 files changed, 21 insertions, 3 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)
diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h
index 0612b92262..a0c1ca17f1 100644
--- a/src/shared/proparser/qmakeparser.h
+++ b/src/shared/proparser/qmakeparser.h
@@ -197,7 +197,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMakeParser::ParseFlags)
class QMAKE_EXPORT ProFileCache
{
public:
- ProFileCache() {}
+ ProFileCache();
~ProFileCache();
void discardFile(int id);
diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp
index c5c5b75c74..f438978bad 100644
--- a/src/shared/proparser/qmakevfs.cpp
+++ b/src/shared/proparser/qmakevfs.cpp
@@ -49,13 +49,23 @@ QMakeVfs::QMakeVfs()
#ifndef QT_NO_TEXTCODEC
m_textCodec = 0;
#endif
+ ref();
+}
+
+QMakeVfs::~QMakeVfs()
+{
+ deref();
+}
+
+void QMakeVfs::ref()
+{
#ifdef PROEVALUATOR_THREAD_SAFE
QMutexLocker locker(&s_mutex);
#endif
++s_refCount;
}
-QMakeVfs::~QMakeVfs()
+void QMakeVfs::deref()
{
#ifdef PROEVALUATOR_THREAD_SAFE
QMutexLocker locker(&s_mutex);
@@ -67,7 +77,6 @@ QMakeVfs::~QMakeVfs()
}
}
-
#ifdef PROPARSER_THREAD_SAFE
QMutex QMakeVfs::s_mutex;
#endif
diff --git a/src/shared/proparser/qmakevfs.h b/src/shared/proparser/qmakevfs.h
index 34dd96fd7b..00547cf7fc 100644
--- a/src/shared/proparser/qmakevfs.h
+++ b/src/shared/proparser/qmakevfs.h
@@ -74,6 +74,9 @@ public:
QMakeVfs();
~QMakeVfs();
+ static void ref();
+ static void deref();
+
int idForFileName(const QString &fn, VfsFlags flags);
QString fileNameForId(int id);
bool writeFile(int id, QIODevice::OpenMode mode, VfsFlags flags, const QString &contents, QString *errStr);