Skip to content
Snippets Groups Projects
Commit 61c31b00 authored by Joseph Ramsay's avatar Joseph Ramsay
Browse files

Re #22265 Change m_presenter to shared_ptr

This prevents a double free when closing the GUI
parent 703a9fcc
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <sstream> #include <sstream>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/make_shared.hpp>
#include <Poco/Path.h> #include <Poco/Path.h>
...@@ -52,13 +53,11 @@ EnggDiffFittingViewQtWidget::EnggDiffFittingViewQtWidget( ...@@ -52,13 +53,11 @@ EnggDiffFittingViewQtWidget::EnggDiffFittingViewQtWidget(
boost::shared_ptr<IEnggDiffractionPythonRunner> mainPythonRunner) boost::shared_ptr<IEnggDiffractionPythonRunner> mainPythonRunner)
: IEnggDiffFittingView(), m_fittedDataVector(), m_mainMsgProvider(mainMsg), : IEnggDiffFittingView(), m_fittedDataVector(), m_mainMsgProvider(mainMsg),
m_mainSettings(mainSettings), m_mainPythonRunner(mainPythonRunner), m_mainSettings(mainSettings), m_mainPythonRunner(mainPythonRunner),
m_presenter(nullptr) { m_presenter(boost::make_shared<EnggDiffFittingPresenter>(
this, Mantid::Kernel::make_unique<EnggDiffFittingModel>(), mainCalib,
mainParam)) {
initLayout(); initLayout();
m_presenter.reset(new EnggDiffFittingPresenter(
this, Mantid::Kernel::make_unique<EnggDiffFittingModel>(), mainCalib,
mainParam));
m_presenter->notify(IEnggDiffFittingPresenter::Start); m_presenter->notify(IEnggDiffFittingPresenter::Start);
} }
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include "ui_EnggDiffractionQtTabFitting.h" #include "ui_EnggDiffractionQtTabFitting.h"
#include <boost/scoped_ptr.hpp>
// Qt classes forward declarations // Qt classes forward declarations
class QMessageBox; class QMessageBox;
class QMutex; class QMutex;
...@@ -244,7 +242,7 @@ private: ...@@ -244,7 +242,7 @@ private:
boost::shared_ptr<IEnggDiffractionPythonRunner> m_mainPythonRunner; boost::shared_ptr<IEnggDiffractionPythonRunner> m_mainPythonRunner;
/// presenter as in the model-view-presenter /// presenter as in the model-view-presenter
boost::scoped_ptr<IEnggDiffFittingPresenter> m_presenter; boost::shared_ptr<IEnggDiffFittingPresenter> m_presenter;
/// current selected instrument /// current selected instrument
/// updated from the EnggDiffractionPresenter processInstChange /// updated from the EnggDiffractionPresenter processInstChange
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment