Skip to content

Commit

Permalink
fix 1075577-80, avoid leak using shared_ptr, re #11060
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Feb 16, 2015
1 parent 07967d0 commit e3c2610
Showing 1 changed file with 9 additions and 8 deletions.
Expand Up @@ -51,32 +51,33 @@ Mantid::API::CoordTransform *CoordTransformDistanceParser::createTransform(
InDimParameterParser inDimParamParser;
Poco::XML::Element *parameter =
dynamic_cast<Poco::XML::Element *>(parameters->item(0));
Mantid::API::InDimParameter *inDimParameter =
inDimParamParser.createWithoutDelegation(parameter);
boost::shared_ptr<Mantid::API::InDimParameter>
inDimParameter(inDimParamParser.createWithoutDelegation(parameter));

// Parse the out dimension parameter.
OutDimParameterParser outDimParamParser;
parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(1));
Mantid::API::OutDimParameter *outDimParameter =
outDimParamParser.createWithoutDelegation(parameter);
boost::shared_ptr<Mantid::API::OutDimParameter>
outDimParameter(outDimParamParser.createWithoutDelegation(parameter));
UNUSED_ARG(outDimParameter); // not actually used as an input.

// Parse the coordinate centre parameter.
CoordCenterParser coordCenterParser;
parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(2));
Mantid::MDEvents::CoordCenterVectorParam *coordCenterParam =
coordCenterParser.createWithoutDelegation(parameter);
boost::shared_ptr<Mantid::MDEvents::CoordCenterVectorParam>
coordCenterParam(coordCenterParser.createWithoutDelegation(parameter));

// Parse the dimensions used parameter.
DimsUsedParser dimsUsedParser;
parameter = dynamic_cast<Poco::XML::Element *>(parameters->item(3));
Mantid::MDEvents::DimensionsUsedVectorParam *dimsUsedVecParm =
dimsUsedParser.createWithoutDelegation(parameter);
boost::shared_ptr<Mantid::MDEvents::DimensionsUsedVectorParam>
dimsUsedVecParm(dimsUsedParser.createWithoutDelegation(parameter));

////Generate the coordinate transform and return
CoordTransformDistance *transform = new CoordTransformDistance(
inDimParameter->getValue(), coordCenterParam->getPointerToStart(),
dimsUsedVecParm->getPointerToStart());

return transform;
}

Expand Down

0 comments on commit e3c2610

Please sign in to comment.