QmlJS/C++: Fix possible crash on exit.

It could crash if a thread to find exported cpp types was still running
after the ModelManager was destroyed.

Change-Id: Ia48fac9c2ad1296992af83af57e84cce8c4f95ae
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-10-20 11:25:38 +02:00
parent 6da15db62c
commit 934c77c2c4
2 changed files with 26 additions and 7 deletions

View File

@@ -69,6 +69,7 @@ class QMLJSTOOLS_EXPORT ModelManager: public QmlJS::ModelManagerInterface
public:
ModelManager(QObject *parent = 0);
~ModelManager();
void delayedInitialization();
@@ -129,8 +130,9 @@ private slots:
private:
static bool matchesMimeType(const Core::MimeType &fileMimeType, const Core::MimeType &knownMimeType);
static void updateCppQmlTypes(ModelManager *qmlModelManager,
CPlusPlus::CppModelManagerInterface *cppModelManager,
static void updateCppQmlTypes(QFutureInterface<void> &interface,
ModelManager *qmlModelManager,
CPlusPlus::Snapshot snapshot,
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents);
mutable QMutex m_mutex;
@@ -144,6 +146,7 @@ private:
QTimer *m_updateCppQmlTypesTimer;
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > m_queuedCppDocuments;
QFuture<void> m_cppQmlTypesUpdater;
CppDataHash m_cppDataHash;
mutable QMutex m_cppDataMutex;