Commit f6a9d01d authored by Daniel Teske's avatar Daniel Teske
Browse files

QmakeProject: Fix crash on unloading project while parsing



Callign applyAsyncEvaluate in the desctructor might lead to further
parses, which we don't want. So bail out early in applyAsyncEvaluate.

Task-number: QTCREATORBUG-13421
Change-Id: I776ff477363a3985ebc26e9160c58c2ab9c910b7
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 7f72b7bf
......@@ -2026,6 +2026,11 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
if (!m_readerExact)
return;
if (m_project->asyncUpdateState() == QmakeProject::ShuttingDown) {
cleanupProFileReaders();
return;
}
foreach (const QString &error, evalResult->errors)
QmakeProject::proFileParseError(error);
......@@ -2258,6 +2263,11 @@ void QmakeProFileNode::applyEvaluate(EvalResult *evalResult)
updateUiFiles(buildDirectory);
cleanupProFileReaders();
}
void QmakeProFileNode::cleanupProFileReaders()
{
m_project->destroyProFileReader(m_readerExact);
m_project->destroyProFileReader(m_readerCumulative);
......
......@@ -447,6 +447,7 @@ private:
void applyEvaluate(Internal::EvalResult *parseResult);
void asyncEvaluate(QFutureInterface<Internal::EvalResult *> &fi, Internal::EvalInput input);
void cleanupProFileReaders();
typedef QHash<QmakeVariable, QStringList> QmakeVariablesHash;
......
......@@ -1675,6 +1675,11 @@ ProjectImporter *QmakeProject::createProjectImporter() const
return new QmakeProjectImporter(projectFilePath().toString());
}
QmakeProject::AsyncUpdateState QmakeProject::asyncUpdateState() const
{
return m_asyncUpdateState;
}
} // namespace QmakeProjectManager
#include "qmakeproject.moc"
......@@ -141,6 +141,9 @@ public:
ProjectExplorer::ProjectImporter *createProjectImporter() const;
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState asyncUpdateState() const;
signals:
void proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool, bool);
void buildDirectoryInitialized();
......@@ -203,7 +206,6 @@ private:
QTimer m_asyncUpdateTimer;
QFutureInterface<void> *m_asyncUpdateFutureInterface;
int m_pendingEvaluateFuturesCount;
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState m_asyncUpdateState;
bool m_cancelEvaluate;
QList<QmakeProFileNode *> m_partialEvaluate;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment