forked from qt-creator/qt-creator
qmake: Fix crash with Qt 6 when canceling parsing
In Qt 5, QFutureWatcher::isFinished was only true if the finished signal was already sent. That changed in Qt 6, where it represents the state of the QFuture instead. Use an explicit bool for representing "finished signal was sent" instead. Task-number: QTCREATORBUG-24098 Change-Id: I4dd8e1c7f6659b2856634d522fb1c0f7eef6741b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -1189,7 +1189,7 @@ QmakeProFile::~QmakeProFile()
|
||||
m_parseFutureWatcher->cancel();
|
||||
m_parseFutureWatcher->waitForFinished();
|
||||
if (m_readerExact)
|
||||
applyAsyncEvaluate();
|
||||
applyAsyncEvaluate(false);
|
||||
delete m_parseFutureWatcher;
|
||||
}
|
||||
cleanupProFileReaders();
|
||||
@@ -1198,8 +1198,9 @@ QmakeProFile::~QmakeProFile()
|
||||
void QmakeProFile::setupFutureWatcher()
|
||||
{
|
||||
m_parseFutureWatcher = new QFutureWatcher<Internal::QmakeEvalResult *>;
|
||||
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished,
|
||||
[this](){ applyAsyncEvaluate(); });
|
||||
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished, [this]() {
|
||||
applyAsyncEvaluate(true);
|
||||
});
|
||||
}
|
||||
|
||||
bool QmakeProFile::isParent(QmakeProFile *node)
|
||||
@@ -1643,9 +1644,9 @@ void QmakeProFile::asyncEvaluate(QFutureInterface<QmakeEvalResult *> &fi, QmakeE
|
||||
fi.reportResult(evalResult);
|
||||
}
|
||||
|
||||
void QmakeProFile::applyAsyncEvaluate()
|
||||
void QmakeProFile::applyAsyncEvaluate(bool apply)
|
||||
{
|
||||
if (m_parseFutureWatcher->isFinished())
|
||||
if (apply)
|
||||
applyEvaluate(m_parseFutureWatcher->result());
|
||||
m_buildSystem->decrementPendingEvaluateFutures();
|
||||
}
|
||||
|
@@ -352,7 +352,7 @@ private:
|
||||
void setParseInProgress(bool b);
|
||||
void setValidParseRecursive(bool b);
|
||||
|
||||
void applyAsyncEvaluate();
|
||||
void applyAsyncEvaluate(bool apply);
|
||||
|
||||
void setupReader();
|
||||
Internal::QmakeEvalInput evalInput() const;
|
||||
|
Reference in New Issue
Block a user