From 6d06ffad61056c1bffa19239b2f6301c97461ff5 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 13 Oct 2014 10:41:04 +0100 Subject: [PATCH 1/5] Fixed trivial issues, mainly uninitialised members Refs #10345 --- .../Mantid/MantidQt/API/src/GenericDialog.cpp | 3 +- .../API/src/MantidQwtIMDWorkspaceData.cpp | 3 +- .../MantidQt/API/src/QwtRasterDataMD.cpp | 3 + .../src/CreateSampleShapeDialog.cpp | 2 +- .../CustomDialogs/src/LoadAsciiDialog.cpp | 8 ++- .../CustomDialogs/src/LoadDAEDialog.cpp | 18 ++++-- .../CustomDialogs/src/LoadRawDialog.cpp | 3 +- .../src/SmoothNeighboursDialog.cpp | 3 +- .../CustomDialogs/src/StartLiveDataDialog.cpp | 4 +- .../SANSDiagnostics.h | 2 +- .../CustomInterfaces/src/ApplyCorr.cpp | 2 +- .../MantidQt/CustomInterfaces/src/Homer.cpp | 4 +- .../src/IndirectDataAnalysis.cpp | 4 +- .../MantidQt/CustomInterfaces/src/MSDFit.cpp | 4 +- .../CustomInterfaces/src/SANSPlotSpecial.cpp | 2 +- .../CustomInterfaces/src/SANSRunWindow.cpp | 2 + .../MantidWidgets/src/FitPropertyBrowser.cpp | 61 +++++++++++++------ .../MantidWidgets/src/PropertyHandler.cpp | 2 + .../RefRangeHandler.h | 2 +- .../src/RefMatrixWSImageView.cpp | 3 +- .../RefDetectorViewer/src/RefRangeHandler.cpp | 13 ++-- .../SliceViewer/src/PhysicalCrossPeak.cpp | 3 +- .../src/ProxyCompositePeaksPresenter.cpp | 3 +- .../SpectrumViewer/src/GraphDisplay.cpp | 4 +- .../SpectrumViewer/src/RangeHandler.cpp | 6 +- .../SpectrumViewer/src/SpectrumDisplay.cpp | 2 +- .../SpectrumViewer/src/SpectrumView.cpp | 9 ++- 27 files changed, 123 insertions(+), 52 deletions(-) diff --git a/Code/Mantid/MantidQt/API/src/GenericDialog.cpp b/Code/Mantid/MantidQt/API/src/GenericDialog.cpp index dae3a1ad2511..1ad125af5f91 100644 --- a/Code/Mantid/MantidQt/API/src/GenericDialog.cpp +++ b/Code/Mantid/MantidQt/API/src/GenericDialog.cpp @@ -43,7 +43,8 @@ using namespace Mantid::API; /** * Default Constructor */ -GenericDialog::GenericDialog(QWidget* parent) : AlgorithmDialog(parent) +GenericDialog::GenericDialog(QWidget* parent) : AlgorithmDialog(parent), + m_algoPropertiesWidget(NULL) { } diff --git a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp index 9ab24cfaaadd..88a8f408b313 100644 --- a/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp +++ b/Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp @@ -94,7 +94,8 @@ MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(Mantid::API::IMDWorkspace_c //----------------------------------------------------------------------------- /// Copy constructor -MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data) +MantidQwtIMDWorkspaceData::MantidQwtIMDWorkspaceData(const MantidQwtIMDWorkspaceData& data) : + m_minPositive(0.0) { this->operator =(data); } diff --git a/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp b/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp index 24ab0cdd4beb..ee059b16603b 100644 --- a/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp +++ b/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp @@ -19,6 +19,9 @@ using Mantid::Geometry::IMDDimension_const_sptr; QwtRasterDataMD::QwtRasterDataMD() : m_ws(), m_overlayWS(), m_slicePoint(NULL), m_fast(true), m_zerosAsNan(true), + m_overlayXMin(0.0), m_overlayXMax(0.0), + m_overlayYMin(0.0), m_overlayYMax(0.0), + m_overlayInSlice(false), m_normalization(Mantid::API::VolumeNormalization) { m_range = QwtDoubleInterval(0.0, 1.0); diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp index 54c9353030ea..238dab402252 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp @@ -38,7 +38,7 @@ using namespace MantidQt::CustomDialogs; * Constructor */ CreateSampleShapeDialog::CreateSampleShapeDialog(QWidget *parent) : - AlgorithmDialog(parent), m_setup_map(), m_details_map(), m_ops_map() + AlgorithmDialog(parent), m_shapeTree(NULL), m_setup_map(), m_details_map(), m_ops_map() { m_object_viewer = new MantidGLWidget; } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp index b3bfe99fc058..97e65a3689a1 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp @@ -15,13 +15,17 @@ namespace MantidQt DECLARE_DIALOG(LoadAsciiDialog) LoadAsciiDialog::LoadAsciiDialog(QWidget *parent) - : MantidQt::API::AlgorithmDialog(parent) + : MantidQt::API::AlgorithmDialog(parent), + m_lineFilename(NULL), + m_lineOutputWorkspace(NULL), + m_lineCommentIndicator(NULL), + m_lineCustomSeparator(NULL), + m_separatorBox(NULL) { } LoadAsciiDialog::~LoadAsciiDialog() { - } void LoadAsciiDialog::initLayout() diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp index ec1a11a1278f..a378f5bc1b41 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp @@ -20,13 +20,19 @@ class NoDeleting { public: /// Does nothing - void operator()(void*){} - /// Does nothing - void operator()(const void*){} - }; + void operator()(void*){} + /// Does nothing + void operator()(const void*){} +}; - LoadDAEDialog::LoadDAEDialog(QWidget *parent) -: MantidQt::API::AlgorithmDialog(parent) +LoadDAEDialog::LoadDAEDialog(QWidget *parent) + : MantidQt::API::AlgorithmDialog(parent), + lineHost(NULL), + lineName(NULL), + minSpLineEdit(NULL), + maxSpLineEdit(NULL), + listSpLineEdit(NULL), + updateLineEdit(NULL) { } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp index 4976b559a89a..685a349fbdce 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp @@ -35,7 +35,8 @@ using namespace MantidQt::CustomDialogs; /** * Constructor */ -LoadRawDialog::LoadRawDialog(QWidget *parent) : AlgorithmDialog(parent) +LoadRawDialog::LoadRawDialog(QWidget *parent) : AlgorithmDialog(parent), + m_pathBox(NULL), m_wsBox(NULL) { } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/SmoothNeighboursDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/SmoothNeighboursDialog.cpp index 74c3e4cea556..57379d6ab99f 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/SmoothNeighboursDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/SmoothNeighboursDialog.cpp @@ -13,7 +13,8 @@ const QString SmoothNeighboursDialog::RECTANGULAR_GROUP = "Rectangular Detectors const QString SmoothNeighboursDialog::INPUT_WORKSPACE = "InputWorkspace"; SmoothNeighboursDialog::SmoothNeighboursDialog(QWidget* parent) - : AlgorithmDialog(parent) + : AlgorithmDialog(parent), + m_propertiesWidget(NULL), m_dialogLayout(NULL) { } diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp index 64babaf5bab8..773926463535 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/StartLiveDataDialog.cpp @@ -71,7 +71,9 @@ namespace CustomDialogs //---------------------- ///Constructor StartLiveDataDialog::StartLiveDataDialog(QWidget *parent) : - AlgorithmDialog(parent) + AlgorithmDialog(parent), + m_useProcessAlgo(false), m_useProcessScript(NULL), + m_usePostProcessAlgo(false), m_usePostProcessScript(false) { // Create the input history. This loads it too. LiveDataAlgInputHistory::Instance(); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSDiagnostics.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSDiagnostics.h index d48972cd4978..4e6189901cbe 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSDiagnostics.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/SANSDiagnostics.h @@ -43,7 +43,7 @@ namespace CustomInterfaces { public: /// constructor - RectDetectorDetails(){} + RectDetectorDetails(): m_minDetId(0), m_maxDetId(0) {} ///destructor ~RectDetectorDetails(){} /// set minimum detector id diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp index b3ea0d159d27..d0d88bf1adac 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp @@ -17,7 +17,7 @@ namespace CustomInterfaces namespace IDA { ApplyCorr::ApplyCorr(QWidget * parent) : - IDATab(parent) + IDATab(parent), m_valPosDbl(NULL) { } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp index 7c1155de353d..0dbe328ed5a5 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp @@ -38,7 +38,9 @@ using namespace MantidQt::CustomInterfaces; Homer::Homer(QWidget *parent, Ui::DirectConvertToEnergy & uiForm) : UserSubWindow(parent), m_uiForm(uiForm), m_backgroundDialog(NULL), m_diagPage(NULL),m_saveChanged(false), - m_backgroundWasVisible(false), m_absEiDirty(false), m_topSettingsGroup("CustomInterfaces/Homer") + m_backgroundWasVisible(false), m_absEiDirty(false), + m_saveChecksGroup(NULL), + m_topSettingsGroup("CustomInterfaces/Homer") {} /// Set up the dialog layout diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp index d880aa990450..85798a0d78de 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataAnalysis.cpp @@ -34,7 +34,9 @@ namespace IDA * @param parent :: the parent QWidget. */ IndirectDataAnalysis::IndirectDataAnalysis(QWidget *parent) : - UserSubWindow(parent), m_dblEdFac(NULL), m_blnEdFac(NULL), + UserSubWindow(parent), + m_valInt(NULL), m_valDbl(NULL), + m_dblEdFac(NULL), m_blnEdFac(NULL), m_changeObserver(*this, &IndirectDataAnalysis::handleDirectoryChange) { // Allows us to get a handle on a tab using an enum, for example "m_tabs[ELWIN]". diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp index 226cd5965c33..2655b41c5877 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp @@ -16,7 +16,9 @@ namespace CustomInterfaces { namespace IDA { - MSDFit::MSDFit(QWidget * parent) : IDATab(parent), m_msdPlot(NULL), m_msdRange(NULL), m_msdDataCurve(NULL), m_msdFitCurve(NULL), + MSDFit::MSDFit(QWidget * parent) : IDATab(parent), + m_intVal(NULL), + m_msdPlot(NULL), m_msdRange(NULL), m_msdDataCurve(NULL), m_msdFitCurve(NULL), m_msdTree(NULL), m_msdProp(), m_msdDblMng(NULL) {} diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSPlotSpecial.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSPlotSpecial.cpp index 8cfc0d5adfec..bf2ae347a6ec 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSPlotSpecial.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSPlotSpecial.cpp @@ -844,7 +844,7 @@ QPair > SANSPlotSpecial::getProperties(const //------- Utility "Transform" Class ---------------------------------- //-------------------------------------------------------------------- SANSPlotSpecial::Transform::Transform(Transform::TransformType type) : m_type(type), - m_xWidgets(QList()), m_yWidgets(QList()), m_gDeriv(""), m_iDeriv("") + m_xWidgets(QList()), m_yWidgets(QList()), m_parent(NULL), m_gDeriv(""), m_iDeriv("") { init(); } diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp index dc2fff810eb0..1767acd57efd 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp @@ -156,11 +156,13 @@ SANSRunWindow::SANSRunWindow(QWidget *parent) : UserSubWindow(parent), m_addFilesTab(NULL), m_displayTab(NULL), m_diagnosticsTab(NULL), m_saveWorkspaces(NULL), m_ins_defdir(""), m_last_dir(""), m_cfg_loaded(true), m_userFname(false), m_sample_file(), + m_reducemapper(NULL), m_warnings_issued(false), m_force_reload(false), m_newInDir(*this, &SANSRunWindow::handleInputDirChange), m_delete_observer(*this, &SANSRunWindow::handleMantidDeleteWorkspace), m_s2d_detlabels(), m_loq_detlabels(), m_allowed_batchtags(), m_have_reducemodule(false), m_dirty_batch_grid(false), m_tmp_batchfile(""), + m_batch_paste(NULL), m_batch_clear(NULL), slicingWindow(NULL) { ConfigService::Instance().addObserver(m_newInDir); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp index 7569e77f952b..5661757ccf5b 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp @@ -85,23 +85,49 @@ namespace MantidWidgets * @param parent :: The parent widget - must be an ApplicationWindow * @param mantidui :: The UI form for MantidPlot */ -FitPropertyBrowser::FitPropertyBrowser(QWidget *parent, QObject* mantidui) -:QDockWidget("Fit Function",parent), -m_logValue(NULL), -m_compositeFunction(), -m_changeSlotsEnabled(false), -m_guessOutputName(true), -m_updateObserver(*this,&FitPropertyBrowser::handleFactoryUpdate), -m_currentHandler(0), -m_defaultFunction("Gaussian"), -m_defaultPeak("Gaussian"), -m_defaultBackground("LinearBackground"), -m_peakToolOn(false), -m_auto_back(false), -m_autoBgName(QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.autoBackground"))), -m_autoBackground(NULL), -m_decimals(-1), -m_mantidui(mantidui) +FitPropertyBrowser::FitPropertyBrowser(QWidget *parent, QObject* mantidui): + QDockWidget("Fit Function",parent), + m_logValue(NULL), + m_plotCompositeMembers(NULL), + m_convolveMembers(NULL), + m_rawData(NULL), + m_xColumn(NULL), + m_yColumn(NULL), + m_errColumn(NULL), + m_showParamErrors(NULL), + m_compositeFunction(), + m_browser(NULL), + m_fitActionUndoFit(NULL), + m_fitActionSeqFit(NULL), + m_fitActionFit(NULL), + m_fitActionEvaluate(NULL), + m_functionsGroup(NULL), + m_settingsGroup(NULL), + m_customSettingsGroup(NULL), + m_changeSlotsEnabled(false), + m_guessOutputName(true), + m_updateObserver(*this,&FitPropertyBrowser::handleFactoryUpdate), + m_fitMapper(NULL), + m_fitMenu(NULL), + m_displayActionPlotGuess(NULL), + m_displayActionQuality(NULL), + m_displayActionClearAll(NULL), + m_setupActionCustomSetup(NULL), + m_setupActionRemove(NULL), + m_tip(NULL), + m_fitSelector(NULL), + m_fitTree(NULL), + m_currentHandler(0), + m_defaultFunction("Gaussian"), + m_defaultPeak("Gaussian"), + m_defaultBackground("LinearBackground"), + m_index_(0), + m_peakToolOn(false), + m_auto_back(false), + m_autoBgName(QString::fromStdString(Mantid::Kernel::ConfigService::Instance().getString("curvefitting.autoBackground"))), + m_autoBackground(NULL), + m_decimals(-1), + m_mantidui(mantidui) { // Make sure plugins are loaded std::string libpath = Mantid::Kernel::ConfigService::Instance().getString("plugins.directory"); @@ -2074,6 +2100,7 @@ void FitPropertyBrowser::deleteTie() QtBrowserItem * ci = m_browser->currentItem(); QtProperty* paramProp = ci->property(); PropertyHandler* h = getHandler()->findHandler(paramProp); + if (!h) return; if (ci->property()->propertyName() != "Tie") { diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp index 72bd55b076a1..26f2aa3bd9b8 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp @@ -41,6 +41,8 @@ PropertyHandler::PropertyHandler(Mantid::API::IFunction_sptr fun, m_parent(parent), m_type(NULL), m_item(item), + m_workspace(NULL), + m_workspaceIndex(NULL), m_isMultispectral(false), m_base(0), m_ci(0), diff --git a/Code/Mantid/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefRangeHandler.h b/Code/Mantid/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefRangeHandler.h index c251cc3990c3..0facba9a1b93 100644 --- a/Code/Mantid/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefRangeHandler.h +++ b/Code/Mantid/MantidQt/RefDetectorViewer/inc/MantidQtRefDetectorViewer/RefRangeHandler.h @@ -62,8 +62,8 @@ class EXPORT_OPT_MANTIDQT_REFDETECTORVIEWER RefRangeHandler : public SpectrumVie Ui_RefImageViewer* iv_ui; double total_min_x; double total_max_x; - double total_max_y; double total_min_y; + double total_max_y; size_t total_n_steps; }; diff --git a/Code/Mantid/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp b/Code/Mantid/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp index 558a8d6fab87..01458b2fc9a0 100644 --- a/Code/Mantid/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp +++ b/Code/Mantid/MantidQt/RefDetectorViewer/src/RefMatrixWSImageView.cpp @@ -18,7 +18,8 @@ using namespace Mantid::API; /** * Construct an ImageView for the specified matrix workspace */ -RefMatrixWSImageView::RefMatrixWSImageView( MatrixWorkspace_sptr /*mat_ws*/ ) +RefMatrixWSImageView::RefMatrixWSImageView( MatrixWorkspace_sptr /*mat_ws*/ ) : + image_view(NULL) { return; // RefMatrixWSDataSource* source = new RefMatrixWSDataSource( mat_ws ); diff --git a/Code/Mantid/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp b/Code/Mantid/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp index b0aaee783531..c15eb69b56e9 100644 --- a/Code/Mantid/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp +++ b/Code/Mantid/MantidQt/RefDetectorViewer/src/RefRangeHandler.cpp @@ -17,9 +17,13 @@ namespace RefDetectorViewer * Construct a RefRangeHandler object to manage min, max and step controls * in the specified UI */ -RefRangeHandler::RefRangeHandler( Ui_RefImageViewer* iv_ui ) +RefRangeHandler::RefRangeHandler( Ui_RefImageViewer* iv_ui ) : + iv_ui(iv_ui), + total_min_x(0.0), total_max_x(0.0), + total_min_y(0.0), total_max_y(0.0), + total_n_steps(0) { - this->iv_ui = iv_ui; + /* this->iv_ui = iv_ui; */ } @@ -30,8 +34,7 @@ RefRangeHandler::RefRangeHandler( Ui_RefImageViewer* iv_ui ) */ void RefRangeHandler::ConfigureRangeControls( SpectrumDataSource* data_source ) { - - //x axis + //x axis total_min_x = data_source->GetXMin(); total_max_x = data_source->GetXMax(); total_n_steps = data_source->GetNCols(); @@ -58,8 +61,6 @@ void RefRangeHandler::ConfigureRangeControls( SpectrumDataSource* data_source ) } SetRange( total_min_y, total_max_y, defaulty_step, 'y' ); - - } diff --git a/Code/Mantid/MantidQt/SliceViewer/src/PhysicalCrossPeak.cpp b/Code/Mantid/MantidQt/SliceViewer/src/PhysicalCrossPeak.cpp index 331860e12796..000827b5f2bc 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/PhysicalCrossPeak.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/PhysicalCrossPeak.cpp @@ -21,7 +21,8 @@ namespace MantidQt m_opacityMin(0.0), m_opacityGradient((m_opacityMin - m_opacityMax)/m_effectiveRadius), m_crossViewFraction(0.015), - m_opacityAtDistance(0.0) + m_opacityAtDistance(0.0), + m_slicePoint(0.0) { } diff --git a/Code/Mantid/MantidQt/SliceViewer/src/ProxyCompositePeaksPresenter.cpp b/Code/Mantid/MantidQt/SliceViewer/src/ProxyCompositePeaksPresenter.cpp index 3249ce6374ab..a734d112be06 100644 --- a/Code/Mantid/MantidQt/SliceViewer/src/ProxyCompositePeaksPresenter.cpp +++ b/Code/Mantid/MantidQt/SliceViewer/src/ProxyCompositePeaksPresenter.cpp @@ -13,7 +13,8 @@ namespace MantidQt m_compositePresenter->registerOwningPresenter(this); } - ProxyCompositePeaksPresenter::ProxyCompositePeaksPresenter() + ProxyCompositePeaksPresenter::ProxyCompositePeaksPresenter() : + m_updateableView(NULL) { } diff --git a/Code/Mantid/MantidQt/SpectrumViewer/src/GraphDisplay.cpp b/Code/Mantid/MantidQt/SpectrumViewer/src/GraphDisplay.cpp index f7afa51747f0..65cf9d734d1a 100644 --- a/Code/Mantid/MantidQt/SpectrumViewer/src/GraphDisplay.cpp +++ b/Code/Mantid/MantidQt/SpectrumViewer/src/GraphDisplay.cpp @@ -27,7 +27,9 @@ namespace SpectrumView */ GraphDisplay::GraphDisplay( QwtPlot* graph_plot, QTableWidget* graph_table, - bool is_vertical ) + bool is_vertical ) : + min_x(0.0), max_x(0.0), + min_y(0.0), max_y(0.0) { this->graph_plot = graph_plot; this->graph_table = graph_table; diff --git a/Code/Mantid/MantidQt/SpectrumViewer/src/RangeHandler.cpp b/Code/Mantid/MantidQt/SpectrumViewer/src/RangeHandler.cpp index 73238c78f253..20cda648141b 100644 --- a/Code/Mantid/MantidQt/SpectrumViewer/src/RangeHandler.cpp +++ b/Code/Mantid/MantidQt/SpectrumViewer/src/RangeHandler.cpp @@ -16,7 +16,10 @@ namespace SpectrumView * Construct a RangeHandler object to manage min, max and step controls * in the specified UI */ -RangeHandler::RangeHandler( Ui_SpectrumViewer* sv_ui ) : IRangeHandler() +RangeHandler::RangeHandler( Ui_SpectrumViewer* sv_ui ) : IRangeHandler(), + total_min_x(0.0), + total_max_x(0.0), + total_n_steps(0) { this->sv_ui = sv_ui; } @@ -29,7 +32,6 @@ RangeHandler::RangeHandler( Ui_SpectrumViewer* sv_ui ) : IRangeHandler() */ void RangeHandler::ConfigureRangeControls( SpectrumDataSource* data_source ) { - total_min_x = data_source->GetXMin(); total_max_x = data_source->GetXMax(); total_n_steps = data_source->GetNCols(); diff --git a/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp b/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp index 0b5caea9fdbf..45aa7066025b 100644 --- a/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp +++ b/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumDisplay.cpp @@ -40,7 +40,7 @@ SpectrumDisplay::SpectrumDisplay( QwtPlot* spectrum_plot, GraphDisplay* h_graph, GraphDisplay* v_graph, QTableWidget* table_widget ) - : data_source(0), spectrum_plot(spectrum_plot), slider_handler(slider_handler), + : data_source(NULL), data_array(NULL), spectrum_plot(spectrum_plot), slider_handler(slider_handler), range_handler(range_handler), h_graph_display(h_graph), v_graph_display(v_graph), image_table(table_widget) { diff --git a/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumView.cpp b/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumView.cpp index 12297305815a..60415867526f 100644 --- a/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumView.cpp +++ b/Code/Mantid/MantidQt/SpectrumViewer/src/SpectrumView.cpp @@ -30,7 +30,14 @@ namespace SpectrumView SpectrumView::SpectrumView(QWidget *parent) : QMainWindow(parent, 0), WorkspaceObserver(), - m_ui(new Ui::SpectrumViewer()) + h_graph(NULL), + v_graph(NULL), + m_ui(new Ui::SpectrumViewer()), + m_slider_handler(NULL), + m_range_handler(NULL), + m_spectrum_display(NULL), + m_sv_connections(NULL), + m_emode_handler(NULL) { m_ui->setupUi(this); } From 44645e152ee487f9364f98c6253bc2c0e7719a19 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 13 Oct 2014 11:09:45 +0100 Subject: [PATCH 2/5] Fixed unchecked casts Refs #10345 --- .../src/CreateSampleShapeDialog.cpp | 4 +- .../MantidQt/CustomInterfaces/src/ConvFit.cpp | 10 +-- .../src/IndirectDataReduction.cpp | 5 +- .../MantidQt/CustomInterfaces/src/JumpFit.cpp | 68 ++++++++++--------- .../SpectrumViewer/src/SVConnections.cpp | 1 + 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp index 238dab402252..c0345f3727b1 100644 --- a/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp +++ b/Code/Mantid/MantidQt/CustomDialogs/src/CreateSampleShapeDialog.cpp @@ -334,6 +334,7 @@ void CreateSampleShapeDialog::addShape(QAction *shape) { // Get the selected item BinaryTreeWidgetItem *parent = getSelectedItem(); + if(!parent) return; if( parent && parent->childCount() == 2 ) return; BinaryTreeWidgetItem *child = new BinaryTreeWidgetItem(QStringList(shape->text())); @@ -360,6 +361,7 @@ void CreateSampleShapeDialog::addOperation(QAction *opt) { //Get the selected item BinaryTreeWidgetItem *selected = getSelectedItem(); + if(!selected) return; if( selected && selected->childCount() == 2 ) return; BinaryTreeWidgetItem *operation = new BinaryTreeWidgetItem; @@ -468,6 +470,7 @@ void CreateSampleShapeDialog::setupDetailsBox() if( m_uiForm.details_scroll->widget() ) m_uiForm.details_scroll->takeWidget(); BinaryTreeWidgetItem *item = dynamic_cast(selection[0]); + if(!item) return; QString shapename = item->text(0); if( m_setup_map.contains(shapename) ) { @@ -484,7 +487,6 @@ void CreateSampleShapeDialog::setupDetailsBox() //Set it as the currently displayed widget m_uiForm.details_scroll->setWidget(obj); } - } /** diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp index 85ccbff755a1..a3e0f0c4e97d 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp @@ -894,15 +894,7 @@ namespace IDA { // Two Lorentz QString pref = prefBase; - - if ( usingCompositeFunc ) - { - pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; - } - else - { - pref += "f" + QString::number(subIndex) + "."; - } + pref += "f" + QString::number(funcIndex) + ".f" + QString::number(subIndex) + "."; m_cfDblMng->setValue(m_cfProp["Lorentzian 2.Amplitude"], parameters[pref+"Amplitude"]); m_cfDblMng->setValue(m_cfProp["Lorentzian 2.PeakCentre"], parameters[pref+"PeakCentre"]); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp index ed47aa0f798b..5661335623c1 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp @@ -314,7 +314,10 @@ void IndirectDataReduction::openDirectoryDialog() */ void IndirectDataReduction::setIDFValues(const QString & prefix) { - dynamic_cast(m_tab_convert_to_energy)->setIDFValues(prefix); + IndirectConvertToEnergy *etTab = dynamic_cast(m_tab_convert_to_energy); + + if(etTab) + etTab->setIDFValues(prefix); } /** diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp index d6492b4c0293..08ec80644cf4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp @@ -181,39 +181,43 @@ namespace MantidQt for (size_t i = 0; i < ws->getNumberHistograms(); ++i) { auto axis = dynamic_cast(ws->getAxis(1)); - std::string title = axis->label(i); - //check if the axis labels indicate this spectrum is width data - size_t qLinesWidthIndex = title.find(".Width"); - size_t convFitWidthIndex = title.find(".FWHM"); - - bool qLinesWidth = qLinesWidthIndex != std::string::npos; - bool convFitWidth = convFitWidthIndex != std::string::npos; - - //if we get a match, add this spectrum to the combobox - if(convFitWidth || qLinesWidth) - { - std::string cbItemName = ""; - size_t substrIndex = 0; - - if (qLinesWidth) - { - substrIndex = qLinesWidthIndex; - } - else if (convFitWidth) - { - substrIndex = convFitWidthIndex; - } - - cbItemName = title.substr(0, substrIndex); - spectraList[cbItemName] = static_cast(i); - m_uiForm.cbWidth->addItem(QString(cbItemName.c_str())); - - //display widths f1.f1, f2.f1 and f2.f2 - if (m_uiForm.cbWidth->count() == 3) - { - return; - } + if(axis) + { + std::string title = axis->label(i); + + //check if the axis labels indicate this spectrum is width data + size_t qLinesWidthIndex = title.find(".Width"); + size_t convFitWidthIndex = title.find(".FWHM"); + + bool qLinesWidth = qLinesWidthIndex != std::string::npos; + bool convFitWidth = convFitWidthIndex != std::string::npos; + + //if we get a match, add this spectrum to the combobox + if(convFitWidth || qLinesWidth) + { + std::string cbItemName = ""; + size_t substrIndex = 0; + + if (qLinesWidth) + { + substrIndex = qLinesWidthIndex; + } + else if (convFitWidth) + { + substrIndex = convFitWidthIndex; + } + + cbItemName = title.substr(0, substrIndex); + spectraList[cbItemName] = static_cast(i); + m_uiForm.cbWidth->addItem(QString(cbItemName.c_str())); + + //display widths f1.f1, f2.f1 and f2.f2 + if (m_uiForm.cbWidth->count() == 3) + { + return; + } + } } } } diff --git a/Code/Mantid/MantidQt/SpectrumViewer/src/SVConnections.cpp b/Code/Mantid/MantidQt/SpectrumViewer/src/SVConnections.cpp index daa4f1203634..ac8c9f256cee 100644 --- a/Code/Mantid/MantidQt/SpectrumViewer/src/SVConnections.cpp +++ b/Code/Mantid/MantidQt/SpectrumViewer/src/SVConnections.cpp @@ -313,6 +313,7 @@ bool SVConnections::eventFilter(QObject *object, QEvent *event) int newY = m_picker_y; QKeyEvent *keyEvent = dynamic_cast(event); + if(!keyEvent) return false; int key = keyEvent->key(); switch (key) { From 44662859f69cac0f08c3e07538a0eb79d3a14613 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 13 Oct 2014 11:50:57 +0100 Subject: [PATCH 3/5] Correct initialisation order warnings Refs #10345 --- Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp | 3 ++- Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp b/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp index ee059b16603b..897926b8bc07 100644 --- a/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp +++ b/Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp @@ -18,10 +18,11 @@ using Mantid::Geometry::IMDDimension_const_sptr; /// Constructor QwtRasterDataMD::QwtRasterDataMD() : m_ws(), m_overlayWS(), - m_slicePoint(NULL), m_fast(true), m_zerosAsNan(true), + m_slicePoint(NULL), m_overlayXMin(0.0), m_overlayXMax(0.0), m_overlayYMin(0.0), m_overlayYMax(0.0), m_overlayInSlice(false), + m_fast(true), m_zerosAsNan(true), m_normalization(Mantid::API::VolumeNormalization) { m_range = QwtDoubleInterval(0.0, 1.0); diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp index 26f2aa3bd9b8..e44adcf5c55f 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp @@ -41,9 +41,9 @@ PropertyHandler::PropertyHandler(Mantid::API::IFunction_sptr fun, m_parent(parent), m_type(NULL), m_item(item), + m_isMultispectral(false), m_workspace(NULL), m_workspaceIndex(NULL), - m_isMultispectral(false), m_base(0), m_ci(0), m_hasPlot(false) From 4a4e9565b1a3a6bdd755a9bc750b523e996334c8 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 17 Oct 2014 13:55:17 +0100 Subject: [PATCH 4/5] Fix copy paste error in FitPropertyBrowser This seemed to be a genuine error which affects the automatic population of the X and Y columns in workspace settings group of fit properties. Refs #10345 --- Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp index 5661757ccf5b..8c90ff90a87a 100644 --- a/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp +++ b/Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp @@ -3046,7 +3046,7 @@ void FitPropertyBrowser::setWorkspaceProperties() { if ( name != xName ) { - m_columnManager->setValue(m_xColumn, columns.indexOf( name )); + m_columnManager->setValue(m_yColumn, columns.indexOf( name )); break; } } From a5659b188ef8436a465f1d7991f4846f7a9b7ff0 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Mon, 17 Nov 2014 13:43:42 +0000 Subject: [PATCH 5/5] Remove old variable from ApplyCorr constructor Refs #10345 --- Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp index 53a895237ea4..3586c5c5acfe 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/ApplyCorr.cpp @@ -18,7 +18,7 @@ namespace CustomInterfaces namespace IDA { ApplyCorr::ApplyCorr(QWidget * parent) : - IDATab(parent), m_valPosDbl(NULL) + IDATab(parent) { }