From 56c29e27f79b01b65d978b15e66291f8f8eceb6c Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 26 Sep 2015 06:46:39 +0200 Subject: [PATCH] Sketcher: Bug fix: Building Vertex Index on Restore =================================================== The bug was introduced by myself here: https://github.com/FreeCAD/FreeCAD/commit/47c0859c1b702b6c7d1dcf5922317c4f325f5d2e [code] void SketchObject::onDocumentRestored() { try { - rebuildExternalGeometry(); + if(Support.getValue()) { + validateExternalLinks(); + rebuildExternalGeometry(); + } Constraints.acceptGeometry(getCompleteGeometry()); } [/code] The issue is that "rebuildExternalGeometry" calls "rebuildVertexIndex". So for any sketch not having external geometry, if you open it, select everything and hit del, you will have a crash because I effectively removed the creation of the index in this dossier. You won't have one if you do anything rebuilding the index before hitting del, like creating geometry, though. --- src/Mod/Sketcher/App/SketchObject.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index f7d8158f3..0b5431b77 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3727,6 +3727,9 @@ void SketchObject::onDocumentRestored() validateExternalLinks(); rebuildExternalGeometry(); } + else { + rebuildVertexIndex(); + } Constraints.acceptGeometry(getCompleteGeometry()); } catch (...) {