diff --git a/src/plugins/qt4projectmanager/profilereader.cpp b/src/plugins/qt4projectmanager/profilereader.cpp index 30c7ad70ea7dbf7b7415d7060d02cca2a3ec805d..3781fc37d057ba98342cee419e01f17bf080a3c4 100644 --- a/src/plugins/qt4projectmanager/profilereader.cpp +++ b/src/plugins/qt4projectmanager/profilereader.cpp @@ -110,8 +110,6 @@ ProFile *ProFileReader::proFileFor(const QString &name) return m_includeFiles.value(name); } - - ProFileCacheManager *ProFileCacheManager::s_instance = 0; ProFileCacheManager::ProFileCacheManager(QObject *parent) : diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 168517d292eff9aaedfc9123e89ea620931ea020..ad1c1fd501adcdb3176fb015503ec161b5e47c49 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -839,6 +839,11 @@ Qt4ProFileNode::~Qt4ProFileNode() delete it.value(); } m_parseFutureWatcher.waitForFinished(); + if (m_readerExact) { + // Oh we need to clean up + applyEvaluate(true, true); + m_project->decrementPendingEvaluateFutures(); + } } bool Qt4ProFileNode::isParent(Qt4ProFileNode *node) @@ -958,9 +963,10 @@ Qt4ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateType t void Qt4ProFileNode::applyEvaluate(bool parseResult, bool async) { + if (!m_readerExact) + return; if (!parseResult || m_project->wasEvaluateCanceled()) { - if (m_readerExact) - m_project->destroyProFileReader(m_readerExact); + m_project->destroyProFileReader(m_readerExact); if (m_readerCumulative) m_project->destroyProFileReader(m_readerCumulative); m_readerExact = m_readerCumulative = 0; diff --git a/src/plugins/qt4projectmanager/qt4project.cpp b/src/plugins/qt4projectmanager/qt4project.cpp index e13c2da0352abfbbd7cbdcbc405325fa362ae222..5b187c98657b5fc23981683846fa8d1f90253fdc 100644 --- a/src/plugins/qt4projectmanager/qt4project.cpp +++ b/src/plugins/qt4projectmanager/qt4project.cpp @@ -248,8 +248,11 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) : Qt4Project::~Qt4Project() { + m_asyncUpdateState = ShuttingDown; m_manager->unregisterProject(this); delete m_projectFiles; + m_cancelEvaluate = true; + delete m_rootProjectNode; } void Qt4Project::updateFileList() @@ -729,17 +732,16 @@ void Qt4Project::decrementPendingEvaluateFutures() m_asyncUpdateFutureInterface = 0; m_cancelEvaluate = false; - // After beeing done, we need to call: - updateFileList(); - updateCodeModel(); - checkForNewApplicationProjects(); - checkForDeletedApplicationProjects(); - // TODO clear the profile cache ? if (m_asyncUpdateState == AsyncFullUpdatePending || m_asyncUpdateState == AsyncPartialUpdatePending) { qDebug()<<" Oh update is pending start the timer"; m_asyncUpdateTimer.start(); - } else { + } else if (m_asyncUpdateState != ShuttingDown){ + // After beeing done, we need to call: + updateFileList(); + updateCodeModel(); + checkForNewApplicationProjects(); + checkForDeletedApplicationProjects(); qDebug()<<" Setting state to Base"; m_asyncUpdateState = Base; } diff --git a/src/plugins/qt4projectmanager/qt4project.h b/src/plugins/qt4projectmanager/qt4project.h index 7846370d3bc0224d13352bd06b72759c3f7566a8..18a24d3ecfdcae9c39f2165f56f15e9c787ef580 100644 --- a/src/plugins/qt4projectmanager/qt4project.h +++ b/src/plugins/qt4projectmanager/qt4project.h @@ -229,7 +229,7 @@ private: QTimer m_asyncUpdateTimer; QFutureInterface<void> *m_asyncUpdateFutureInterface; int m_pendingEvaluateFuturesCount; - enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress }; + enum AsyncUpdateState { NoState, Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown }; AsyncUpdateState m_asyncUpdateState; bool m_cancelEvaluate; QList<Internal::Qt4ProFileNode *> m_partialEvaluate;