Commit ea53e58f authored by Robert Applin's avatar Robert Applin
Browse files

Refs #30362. Remove changes to indirect for safety.

parent 82605af1
......@@ -51,12 +51,7 @@ FourierTransform::FourierTransform(QWidget *parent)
/**
* @brief Destructor
*/
FourierTransform::~FourierTransform() {
m_propertyTree->unsetFactoryForManager(m_doubleManager);
m_propertyTree->unsetFactoryForManager(m_boolManager);
m_propertyTree->unsetFactoryForManager(m_enumManager);
delete m_propertyTree;
}
FourierTransform::~FourierTransform() { delete m_propertyTree; }
/* *********************
* ** Private Slots **
......
......@@ -37,15 +37,6 @@ namespace IDA {
FunctionTemplateBrowser::FunctionTemplateBrowser(QWidget *parent)
: QWidget(parent), m_decimals(6) {}
FunctionTemplateBrowser::~FunctionTemplateBrowser() {
m_browser->unsetFactoryForManager(m_stringManager);
m_browser->unsetFactoryForManager(m_doubleManager);
m_browser->unsetFactoryForManager(m_intManager);
m_browser->unsetFactoryForManager(m_boolManager);
m_browser->unsetFactoryForManager(m_enumManager);
m_browser->unsetFactoryForManager(m_parameterManager);
}
void FunctionTemplateBrowser::createBrowser() {
m_stringManager = new QtStringPropertyManager(this);
m_doubleManager = new QtDoublePropertyManager(this);
......
......@@ -44,7 +44,7 @@ class MANTIDQT_INDIRECT_DLL FunctionTemplateBrowser : public QWidget {
Q_OBJECT
public:
FunctionTemplateBrowser(QWidget *parent);
virtual ~FunctionTemplateBrowser();
virtual ~FunctionTemplateBrowser() = default;
void init();
virtual void setFunction(const QString &funStr) = 0;
......
......@@ -198,10 +198,7 @@ ISISCalibration::ISISCalibration(IndirectDataReduction *idrUI, QWidget *parent)
//----------------------------------------------------------------------------------------------
/** Destructor
*/
ISISCalibration::~ISISCalibration() {
m_propTrees["CalPropTree"]->unsetFactoryForManager(m_dblManager);
m_propTrees["ResPropTree"]->unsetFactoryForManager(m_dblManager);
}
ISISCalibration::~ISISCalibration() {}
std::pair<double, double> ISISCalibration::peakRange() const {
return std::make_pair(m_dblManager->value(m_properties["CalPeakMin"]),
......
......@@ -149,10 +149,7 @@ ISISDiagnostics::ISISDiagnostics(IndirectDataReduction *idrUI, QWidget *parent)
//----------------------------------------------------------------------------------------------
/** Destructor
*/
ISISDiagnostics::~ISISDiagnostics() {
m_propTrees["SlicePropTree"]->unsetFactoryForManager(m_dblManager);
m_propTrees["SlicePropTree"]->unsetFactoryForManager(m_blnManager);
}
ISISDiagnostics::~ISISDiagnostics() {}
void ISISDiagnostics::setup() {}
......
......@@ -18,9 +18,7 @@ IndirectBayesTab::IndirectBayesTab(QWidget *parent)
SLOT(updateProperties(QtProperty *, double)));
}
IndirectBayesTab::~IndirectBayesTab() {
m_propTree->unsetFactoryForManager(m_dblManager);
}
IndirectBayesTab::~IndirectBayesTab() {}
/**
* Prevents the loading of data with incorrect naming if passed true
......
......@@ -105,11 +105,6 @@ IndirectDataAnalysisElwinTab::IndirectDataAnalysisElwinTab(QWidget *parent)
m_uiForm.ipoPlotOptions, this, PlotWidget::Spectra));
}
IndirectDataAnalysisElwinTab::~IndirectDataAnalysisElwinTab() {
m_elwTree->unsetFactoryForManager(m_dblManager);
m_elwTree->unsetFactoryForManager(m_blnManager);
}
void IndirectDataAnalysisElwinTab::setup() {
// Create QtTreePropertyBrowser object
m_elwTree = new QtTreePropertyBrowser();
......
......@@ -18,7 +18,6 @@ class DLLExport IndirectDataAnalysisElwinTab : public IndirectDataAnalysisTab {
public:
IndirectDataAnalysisElwinTab(QWidget *parent = nullptr);
~IndirectDataAnalysisElwinTab();
private:
void run() override;
......
......@@ -155,10 +155,6 @@ IndirectDataAnalysisIqtTab::IndirectDataAnalysisIqtTab(QWidget *parent)
m_uiForm.ipoPlotOptions, this, PlotWidget::SpectraTiled));
}
IndirectDataAnalysisIqtTab::~IndirectDataAnalysisIqtTab() {
m_iqtTree->unsetFactoryForManager(m_dblManager);
}
void IndirectDataAnalysisIqtTab::setup() {
m_iqtTree = new QtTreePropertyBrowser();
m_uiForm.properties->addWidget(m_iqtTree);
......
......@@ -17,7 +17,6 @@ class DLLExport IndirectDataAnalysisIqtTab : public IndirectDataAnalysisTab {
public:
IndirectDataAnalysisIqtTab(QWidget *parent = nullptr);
~IndirectDataAnalysisIqtTab();
private:
void run() override;
......
......@@ -84,9 +84,7 @@ IndirectMoments::IndirectMoments(IndirectDataReduction *idrUI, QWidget *parent)
//----------------------------------------------------------------------------------------------
/** Destructor
*/
IndirectMoments::~IndirectMoments() {
m_propTrees["MomentsPropTree"]->unsetFactoryForManager(m_dblManager);
}
IndirectMoments::~IndirectMoments() {}
void IndirectMoments::setup() {}
......
......@@ -165,9 +165,7 @@ IndirectSymmetrise::IndirectSymmetrise(IndirectDataReduction *idrUI,
//----------------------------------------------------------------------------------------------
/** Destructor
*/
IndirectSymmetrise::~IndirectSymmetrise() {
m_propTrees["SymmPropTree"]->unsetFactoryForManager(m_dblManager);
}
IndirectSymmetrise::~IndirectSymmetrise() {}
void IndirectSymmetrise::setup() {}
......
......@@ -4,7 +4,6 @@ set(
ConvFitDataPresenterTest.h
ConvFitModelTest.h
ConvFunctionModelTest.h
FunctionTemplateBrowserTest.h
IndirectDataValidationHelperTest.h
IndirectDataTablePresenterTest.h
IndirectFitAnalysisTabTest.h
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2020 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "FunctionTemplateBrowser.h"
#include <cxxtest/TestSuite.h>
#include <memory>
using namespace MantidQt::CustomInterfaces::IDA;
/*
* This test was created in response to finding an unreliable Read Access
* Violation when creating the FunctionTemplateBrowser. This failure would
* happen once every 100-200 attempts to instantiate this class.
*
* Its cause was a dangling pointer to a manager object being left behind when
* destructing a FunctionTemplateBrowser. This dangling point was still existing
* in a global static variable (m_managerToFactoryToViews or
* m_viewToManagerToFactory) in qtpropertybrowser.cpp. When creating a new
* instance of FunctionTemplateBrowser, the memory location would sometimes be
* reused, causing problems.
* The solution used to fix this was to do:
* m_browser->unsetFactoryForManager(m_manager)
* in the destructor of FunctionTemplateBrowser.
*/
class FunctionTemplateBrowserTest : public CxxTest::TestSuite {
public:
static FunctionTemplateBrowserTest *createSuite() {
return new FunctionTemplateBrowserTest;
}
static void destroySuite(FunctionTemplateBrowserTest *suite) { delete suite; }
void setUp() override { m_numberOfTries = 100u; }
void tearDown() override { m_functionTreeView.reset(); }
void
test_that_the_FunctionTemplateBrowserTest_can_be_instantiated_many_times_without_instability() {
for (auto i = 0u; i < m_numberOfTries; ++i)
m_functionTreeView = std::make_unique<FunctionTemplateBrowser>(nullptr);
}
private:
std::size_t m_numberOfTries;
std::unique_ptr<FunctionTemplateBrowser> m_functionTreeView;
};
......@@ -73,7 +73,6 @@ public:
};
explicit InstrumentWidgetMaskTab(InstrumentWidget *instrWidget);
~InstrumentWidgetMaskTab();
void initSurface() override;
void setMode(Mode mode);
void selectTool(Activity tool);
......
......@@ -370,10 +370,6 @@ InstrumentWidgetMaskTab::InstrumentWidgetMaskTab(InstrumentWidget *instrWidget)
SLOT(enableApplyButtons()));
}
InstrumentWidgetMaskTab::~InstrumentWidgetMaskTab() {
m_browser->unsetFactoryForManager(m_doubleManager);
}
/**
* Initialize the tab when new projection surface is created.
*/
......
Supports Markdown
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