diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii2.h b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii2.h index ea3382e4cd44acfecce04dd31ce1b905d266c070..f915d9d54bbc341124a47cc247b470ac8fdb0931 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadAscii2.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadAscii2.h @@ -120,7 +120,7 @@ private: size_t m_spectrumIDcount; size_t m_lineNo; std::vector<DataObjects::Histogram1D> m_spectra; - DataObjects::Histogram1D *m_curSpectra; + std::unique_ptr<DataObjects::Histogram1D> m_curSpectra; std::vector<double> m_curDx; }; diff --git a/Framework/DataHandling/src/LoadAscii2.cpp b/Framework/DataHandling/src/LoadAscii2.cpp index 9cf20ddc3a4843746b5e3b26630bd069c3385a54..e53310aa04e5e49fa5ce793cfcff3fd7c3fafe5f 100644 --- a/Framework/DataHandling/src/LoadAscii2.cpp +++ b/Framework/DataHandling/src/LoadAscii2.cpp @@ -79,9 +79,9 @@ API::Workspace_sptr LoadAscii2::readData(std::ifstream &file) { m_spectrumIDcount = 0; m_spectra.clear(); - m_curSpectra = - new DataObjects::Histogram1D(HistogramData::Histogram::XMode::Points, - HistogramData::Histogram::YMode::Counts); + m_curSpectra = Kernel::make_unique<DataObjects::Histogram1D>( + HistogramData::Histogram::XMode::Points, + HistogramData::Histogram::YMode::Counts); std::string line; std::list<std::string> columns; @@ -123,7 +123,7 @@ API::Workspace_sptr LoadAscii2::readData(std::ifstream &file) { << e.what(); throw std::runtime_error(msg.str()); } - delete m_curSpectra; + m_curSpectra.reset(); return localWorkspace; } @@ -514,13 +514,12 @@ void LoadAscii2::newSpectra() { m_curSpectra->setPointStandardDeviations(std::move(m_curDx)); m_spectra.push_back(*m_curSpectra); } - delete m_curSpectra; - m_curSpectra = nullptr; + m_curSpectra.reset(); } - m_curSpectra = - new DataObjects::Histogram1D(HistogramData::Histogram::XMode::Points, - HistogramData::Histogram::YMode::Counts); + m_curSpectra = Kernel::make_unique<DataObjects::Histogram1D>( + HistogramData::Histogram::XMode::Points, + HistogramData::Histogram::YMode::Counts); m_curDx.clear(); m_spectraStart = true; }