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

@@ -74,13 +74,14 @@ bool isSketcherVirtualSpaceActive(Gui::Document* doc, bool actsOnSelection)
void ActivateVirtualSpaceHandler(Gui::Document* doc, 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(handler);
vp->activateHandler(std::move(ptr));
}
}
}