Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/10345_coverity_issues_in_…
Browse files Browse the repository at this point in the history
…mantidqt'
  • Loading branch information
Harry Jeffery committed Nov 19, 2014
2 parents a27f52d + a5659b1 commit 7988c26
Show file tree
Hide file tree
Showing 32 changed files with 150 additions and 80 deletions.
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/API/src/GenericDialog.cpp
Expand Up @@ -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)
{
}

Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/API/src/MantidQwtIMDWorkspaceData.cpp
Expand Up @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion Code/Mantid/MantidQt/API/src/QwtRasterDataMD.cpp
Expand Up @@ -18,7 +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);
Expand Down
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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()));
Expand All @@ -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;
Expand Down Expand Up @@ -468,6 +470,7 @@ void CreateSampleShapeDialog::setupDetailsBox()
if( m_uiForm.details_scroll->widget() ) m_uiForm.details_scroll->takeWidget();

BinaryTreeWidgetItem *item = dynamic_cast<BinaryTreeWidgetItem*>(selection[0]);
if(!item) return;
QString shapename = item->text(0);
if( m_setup_map.contains(shapename) )
{
Expand All @@ -484,7 +487,6 @@ void CreateSampleShapeDialog::setupDetailsBox()
//Set it as the currently displayed widget
m_uiForm.details_scroll->setWidget(obj);
}

}

/**
Expand Down
8 changes: 6 additions & 2 deletions Code/Mantid/MantidQt/CustomDialogs/src/LoadAsciiDialog.cpp
Expand Up @@ -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()
Expand Down
18 changes: 12 additions & 6 deletions Code/Mantid/MantidQt/CustomDialogs/src/LoadDAEDialog.cpp
Expand Up @@ -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)
{
}

Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidQt/CustomDialogs/src/LoadRawDialog.cpp
Expand Up @@ -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)
{
}

Expand Down
Expand Up @@ -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)
{
}

Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -21,7 +21,7 @@ namespace IDA
virtual void run();
virtual bool validate();
virtual void loadSettings(const QSettings & settings);
virtual QString helpURL() {return "MSDFit";}
virtual QString helpURL() { return "MSDFit"; }

private slots:
void singleFit();
Expand All @@ -30,9 +30,9 @@ namespace IDA
void minChanged(double val);
void maxChanged(double val);
void updateRS(QtProperty* prop, double val);

private:
QString currentWsName;
QString m_currentWsName;
QtTreePropertyBrowser* m_msdTree;

};
Expand Down
Expand Up @@ -43,7 +43,7 @@ namespace CustomInterfaces
{
public:
/// constructor
RectDetectorDetails(){}
RectDetectorDetails(): m_minDetId(0), m_maxDetId(0) {}
///destructor
~RectDetectorDetails(){}
/// set minimum detector id
Expand Down
10 changes: 1 addition & 9 deletions Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp
Expand Up @@ -880,15 +880,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_dblManager->setValue(m_properties["Lorentzian 2.Amplitude"], parameters[pref+"Amplitude"]);
m_dblManager->setValue(m_properties["Lorentzian 2.PeakCentre"], parameters[pref+"PeakCentre"]);
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/Homer.cpp
Expand Up @@ -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
Expand Down
Expand Up @@ -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]".
Expand Down
5 changes: 4 additions & 1 deletion Code/Mantid/MantidQt/CustomInterfaces/src/JumpFit.cpp
Expand Up @@ -277,7 +277,10 @@ namespace MantidQt
for (size_t i = 0; i < ws->getNumberHistograms(); ++i)
{
auto axis = dynamic_cast<Mantid::API::TextAxis*>(ws->getAxis(1));
std::string title = axis->label(i);
if(!axis)
return;

std::string title = axis->label(i);

//check if the axis labels indicate this spectrum is width data
size_t qLinesWidthIndex = title.find(".Width");
Expand Down
6 changes: 3 additions & 3 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MSDFit.cpp
Expand Up @@ -17,7 +17,7 @@ namespace CustomInterfaces
namespace IDA
{
MSDFit::MSDFit(QWidget * parent) : IDATab(parent),
m_msdTree(NULL)
m_currentWsName(""), m_msdTree(NULL)
{
}

Expand Down Expand Up @@ -163,7 +163,7 @@ namespace IDA
int minIndex = 0;
int maxIndex = nHist - 1;

if (currentWsName == wsname)
if (m_currentWsName == wsname)
{
if (!plotSpec.isEmpty() && plotSpec.toInt() < nHist)
{
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace IDA
showMessageBox(exc.what());
}

currentWsName = wsname;
m_currentWsName = wsname;
}

void MSDFit::minChanged(double val)
Expand Down
Expand Up @@ -844,7 +844,7 @@ QPair<QStringList, QMap<QString, double> > SANSPlotSpecial::getProperties(const
//------- Utility "Transform" Class ----------------------------------
//--------------------------------------------------------------------
SANSPlotSpecial::Transform::Transform(Transform::TransformType type) : m_type(type),
m_xWidgets(QList<QWidget*>()), m_yWidgets(QList<QWidget*>()), m_gDeriv(""), m_iDeriv("")
m_xWidgets(QList<QWidget*>()), m_yWidgets(QList<QWidget*>()), m_parent(NULL), m_gDeriv(""), m_iDeriv("")
{
init();
}
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/src/SANSRunWindow.cpp
Expand Up @@ -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);
Expand Down
63 changes: 45 additions & 18 deletions Code/Mantid/MantidQt/MantidWidgets/src/FitPropertyBrowser.cpp
Expand Up @@ -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");
Expand Down Expand Up @@ -2081,6 +2107,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")
{
Expand Down Expand Up @@ -3026,7 +3053,7 @@ void FitPropertyBrowser::setWorkspaceProperties()
{
if ( name != xName )
{
m_columnManager->setValue(m_xColumn, columns.indexOf( name ));
m_columnManager->setValue(m_yColumn, columns.indexOf( name ));
break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/MantidQt/MantidWidgets/src/PropertyHandler.cpp
Expand Up @@ -42,6 +42,8 @@ PropertyHandler::PropertyHandler(Mantid::API::IFunction_sptr fun,
m_type(NULL),
m_item(item),
m_isMultispectral(false),
m_workspace(NULL),
m_workspaceIndex(NULL),
m_base(0),
m_ci(0),
m_hasPlot(false)
Expand Down
Expand Up @@ -62,8 +62,8 @@ class EXPORT_OPT_MANTIDQT_REFDETECTORVIEWER RefRangeHandler : public SpectrumVie

double m_totalMinX;
double m_totalMaxX;
double m_totalMaxY;
double m_totalMinY;
double m_totalMaxY;
size_t m_totalNSteps;

};
Expand Down
Expand Up @@ -238,10 +238,10 @@ RefIVConnections::RefIVConnections( Ui_RefImageViewer* ui,
this, SLOT(grayColorScale()) );

QObject::connect(m_ivUI->actionNegative_Gray, SIGNAL(triggered()),
this, SLOT(negative_grayColorScale()) );
this, SLOT(negativeGrayColorScale()) );

QObject::connect(m_ivUI->actionGreen_Yellow, SIGNAL(triggered()),
this, SLOT(green_yellowColorScale()) );
this, SLOT(greenYellowColorScale()) );

QObject::connect(m_ivUI->actionRainbow, SIGNAL(triggered()),
this, SLOT(rainbowColorScale()) );
Expand Down

0 comments on commit 7988c26

Please sign in to comment.