Commit a7f237d1 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

CMake: Make future-handling in ServerModeReader more robust



Change-Id: Id2fc5487fdfb7619db2eee2439e5636afdc39add
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent c286d16c
......@@ -148,7 +148,7 @@ void ServerModeReader::parse(bool force)
return i.toArgument(m_parameters.expander);
})));
m_future = new QFutureInterface<void>();
m_future.reset(new QFutureInterface<void>());
m_future->setProgressRange(0, MAX_PROGRESS);
m_progressStepMinimum = 0;
m_progressStepMaximum = 1000;
......@@ -164,8 +164,7 @@ void ServerModeReader::stop()
if (m_future) {
m_future->reportCanceled();
m_future->reportFinished();
delete m_future;
m_future = nullptr;
m_future.reset();
}
}
......@@ -176,7 +175,7 @@ bool ServerModeReader::isReady() const
bool ServerModeReader::isParsing() const
{
return false;
return static_cast<bool>(m_future);
}
bool ServerModeReader::hasData() const
......@@ -288,8 +287,7 @@ void ServerModeReader::handleReply(const QVariantMap &data, const QString &inRep
if (m_future) {
m_future->setProgressValue(MAX_PROGRESS);
m_future->reportFinished();
delete m_future;
m_future = nullptr;
m_future.reset();
}
m_hasData = true;
emit dataAvailable();
......
......@@ -122,7 +122,7 @@ private:
bool m_hasData = false;
std::unique_ptr<ServerMode> m_cmakeServer;
QFutureInterface<void> *m_future = nullptr;
std::unique_ptr<QFutureInterface<void>> m_future;
int m_progressStepMinimum;
int m_progressStepMaximum;
......
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