Fix memory leak in sketcher view provider
This commit is contained in:
parent
8952058a2b
commit
d2ac422f68
|
@ -265,10 +265,14 @@ protected:
|
|||
std::vector<std::string> getDisplayMaskModes() const;
|
||||
void setDefaultMode(int);
|
||||
//@}
|
||||
/// Helper method to get picked entities while editing
|
||||
/** Helper method to get picked entities while editing.
|
||||
* It's in the responsibility of the caller to delete the returned instance.
|
||||
*/
|
||||
SoPickedPoint* getPointOnRay(const SbVec2s& pos,
|
||||
const View3DInventorViewer* viewer) const;
|
||||
/// Helper method to get picked entities while editing
|
||||
/** Helper method to get picked entities while editing.
|
||||
* It's in the responsibility of the caller to delete the returned instance.
|
||||
*/
|
||||
SoPickedPoint* getPointOnRay(const SbVec3f& pos, const SbVec3f& dir,
|
||||
const View3DInventorViewer* viewer) const;
|
||||
/// Reimplemented from subclass
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#endif
|
||||
|
||||
#include <Inventor/SbTime.h>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include <Base/Tools.h>
|
||||
|
@ -362,7 +363,8 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
|
|||
SbVec3f point = viewer->getPointOnScreen(cursorPos);
|
||||
SbVec3f normal = viewer->getViewDirection();
|
||||
|
||||
SoPickedPoint *pp = this->getPointOnRay(cursorPos, viewer);
|
||||
// use scoped_ptr to make sure that instance gets deleted in all cases
|
||||
boost::scoped_ptr<SoPickedPoint> pp(this->getPointOnRay(cursorPos, viewer));
|
||||
|
||||
// Radius maximum to allow double click event
|
||||
const int dblClickRadius = 5;
|
||||
|
@ -784,9 +786,9 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
|
|||
Mode!=STATUS_SKETCH_DragConstraint) {
|
||||
|
||||
SoPickedPoint *pp = this->getPointOnRay(cursorPos, viewer);
|
||||
|
||||
int PtIndex,GeoIndex,ConstrIndex,CrossIndex;
|
||||
preselectChanged = detectPreselection(pp,PtIndex,GeoIndex,ConstrIndex,CrossIndex);
|
||||
delete pp;
|
||||
}
|
||||
|
||||
switch (Mode) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user