Commit 1078e588 authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Use unique_ptr rather than raw new/delete

parent eec3a335
......@@ -248,12 +248,13 @@ boost::shared_ptr<API::ExperimentInfo> LoadSQW2::readSingleSPEHeader() {
// lattice - alatt, angdeg, cu, cv = 12 values
std::vector<float> floats;
m_reader->read(floats, 12);
auto lattice = new OrientedLattice(floats[0], floats[1], floats[2], floats[3],
floats[4], floats[5]);
auto lattice = Kernel::make_unique<OrientedLattice>(
floats[0], floats[1], floats[2], floats[3], floats[4], floats[5]);
V3D uVec(floats[6], floats[7], floats[8]),
vVec(floats[9], floats[10], floats[11]);
lattice->setUFromVectors(uVec, vVec);
sample.setOrientedLattice(lattice);
// Lattice is copied into the Sample object
sample.setOrientedLattice(lattice.get());
if (g_log.is(Logger::Priority::PRIO_DEBUG)) {
std::stringstream os;
os << "Lattice:"
......@@ -269,8 +270,6 @@ boost::shared_ptr<API::ExperimentInfo> LoadSQW2::readSingleSPEHeader() {
<< "Inverse B matrix (calculated): " << lattice->getBinv() << "\n";
g_log.debug(os.str());
}
// Lattice is copied into the Sample object
delete lattice;
// goniometer angles
float psi(0.0f), omega(0.0f), dpsi(0.0f), gl(0.0f), gs(0.0f);
......
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