fix unique ptr usage in sketch (#15008)

* fix unique ptr usage in sketch

* [pre-commit.ci] auto fixes from pre-commit.com hooks
This commit is contained in:
ppphp
2024-07-08 23:53:49 +08:00
committed by GitHub
parent 24c7d3ef25
commit 51c6dbd3e3
11 changed files with 110 additions and 112 deletions

View File

@@ -476,16 +476,15 @@ void SketcherGui::GetCirclesMinimalDistance(const Part::Geometry* geom1,
}
}
void SketcherGui::ActivateHandler(Gui::Document* doc, DrawSketchHandler* handler)
void SketcherGui::ActivateHandler(Gui::Document* doc, std::unique_ptr<DrawSketchHandler> handler)
{
std::unique_ptr<DrawSketchHandler> ptr(handler);
if (doc) {
if (doc->getInEdit()
&& doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) {
SketcherGui::ViewProviderSketch* vp =
static_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
vp->purgeHandler();
vp->activateHandler(ptr.release());
vp->activateHandler(std::move(handler));
}
}
}