forked from qt-creator/qt-creator
Fix crash for closing creator while evaluate is still in progress
This commit is contained in:
@@ -110,8 +110,6 @@ ProFile *ProFileReader::proFileFor(const QString &name)
|
||||
return m_includeFiles.value(name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ProFileCacheManager *ProFileCacheManager::s_instance = 0;
|
||||
|
||||
ProFileCacheManager::ProFileCacheManager(QObject *parent) :
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user