diff --git a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp index 32dc3f922e..4039caa576 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherTools.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include # include # include # include @@ -74,15 +75,14 @@ bool isSketcherAcceleratorActive(Gui::Document *doc, bool actsOnSelection ) return false; } -void ActivateAcceleratorHandler(Gui::Document *doc,DrawSketchHandler *handler) +void ActivateAcceleratorHandler(Gui::Document *doc, DrawSketchHandler *handler) { + std::unique_ptr ptr(handler); if (doc) { - if (doc->getInEdit() && doc->getInEdit()->isDerivedFrom - (SketcherGui::ViewProviderSketch::getClassTypeId())) { - + if (doc->getInEdit() && doc->getInEdit()->isDerivedFrom(SketcherGui::ViewProviderSketch::getClassTypeId())) { SketcherGui::ViewProviderSketch* vp = static_cast (doc->getInEdit()); vp->purgeHandler(); - vp->activateHandler(handler); + vp->activateHandler(ptr.release()); } } }