From 065f1562b3fa6b0db4f44058ea6443a30c623f24 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 8 Dec 2016 15:06:35 +0100 Subject: [PATCH] AbstractProcessStep: Fix double-free of QFutureInterface Partial revert of 732b83297302cc9ca4afa7c6632adf8112b1aa19 Change-Id: I22e1af3071b7345eae6459cfdfe5e3699f4ee804 Reviewed-by: Christian Stenger --- src/plugins/projectexplorer/abstractprocessstep.cpp | 7 +++---- src/plugins/projectexplorer/abstractprocessstep.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp index 8e988c09d66..4e64bb09eb7 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.cpp +++ b/src/plugins/projectexplorer/abstractprocessstep.cpp @@ -186,7 +186,7 @@ void AbstractProcessStep::run(QFutureInterface &fi) return; } - m_futureInterface.reset(&fi); + m_futureInterface = &fi; m_process.reset(new Utils::QtcProcess()); m_process->setUseCtrlCStub(Utils::HostOsInfo::isWindowsHost()); @@ -222,8 +222,7 @@ void AbstractProcessStep::cleanUp() m_process.reset(); // Report result - reportRunResult(*(m_futureInterface.get()), returnValue); - m_futureInterface.reset(); + reportRunResult(*m_futureInterface, returnValue); } /*! @@ -338,7 +337,7 @@ void AbstractProcessStep::stdError(const QString &line) QFutureInterface *AbstractProcessStep::futureInterface() const { - return m_futureInterface.get(); + return m_futureInterface; } void AbstractProcessStep::checkForCancel() diff --git a/src/plugins/projectexplorer/abstractprocessstep.h b/src/plugins/projectexplorer/abstractprocessstep.h index 8e8d3427811..847a2f4208a 100644 --- a/src/plugins/projectexplorer/abstractprocessstep.h +++ b/src/plugins/projectexplorer/abstractprocessstep.h @@ -89,7 +89,7 @@ private: void outputAdded(const QString &string, BuildStep::OutputFormat format); QTimer m_timer; - std::unique_ptr> m_futureInterface; + QFutureInterface *m_futureInterface; std::unique_ptr m_process; std::unique_ptr m_outputParserChain; ProcessParameters m_param;