From 1d10676d5da13489ce6af02314a7dfdcbbd2daef Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 27 Jan 2012 10:53:51 +0000 Subject: [PATCH] 0000581: crash when editing duplicated sketch git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5427 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/App/Document.cpp | 1 + src/App/DocumentObject.h | 2 ++ src/Mod/Sketcher/App/SketchObject.cpp | 7 +++++++ src/Mod/Sketcher/App/SketchObject.h | 1 + 4 files changed, 11 insertions(+) diff --git a/src/App/Document.cpp b/src/App/Document.cpp index d70734bfaa..1b9879ee61 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1529,6 +1529,7 @@ DocumentObject* Document::_copyObject(DocumentObject* obj, std::maponFinishDuplicating(); copy->purgeTouched(); return copy; } diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index 48c3f67515..70a91ffe11 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -181,6 +181,8 @@ protected: virtual void onChanged(const Property* prop); /// get called after a document has been fully restored virtual void onDocumentRestored() {} + /// get called after duplicating an object + virtual void onFinishDuplicating() {} /// python object of this class and all descendend protected: // attributes diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 330ff5ca63..95aa455a77 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -1441,6 +1441,13 @@ void SketchObject::onDocumentRestored() } } +void SketchObject::onFinishDuplicating() +{ + Constraints.acceptGeometry(getCompleteGeometry()); + rebuildVertexIndex(); + onDocumentRestored(); +} + void SketchObject::getGeoVertexIndex(int VertexId, int &GeoId, PointPos &PosId) { if (VertexId < 0 || VertexId >= int(VertexId2GeoId.size())) { diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index eef799bf75..83802d83a3 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -152,6 +152,7 @@ protected: /// get called by the container when a property has changed virtual void onChanged(const App::Property* /*prop*/); virtual void onDocumentRestored(); + virtual void onFinishDuplicating(); private: std::vector ExternalGeo;