From ca8be01a4b63fddcf1be96162323cf3c3839ab82 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Sun, 16 Aug 2015 05:41:27 +0300 Subject: [PATCH] Fix a crash then sketch calls recalculation --- src/Gui/Document.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index b4be78722..439506b59 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -511,14 +511,14 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop // cycling to all views of the document to remove the viewprovider from the viewer itself for (std::list::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) { View3DInventor *activeView = dynamic_cast(*vIt); - if (activeView && viewProvider) { + if (activeView && viewProvider && activeView->getViewer()->hasViewProvider(ChildViewProvider)) { + // Note about hasViewProvider() + //remove the viewprovider serves the purpose of detaching the inventor nodes from the + //top level root in the viewer. However, if some of the children were grouped beneath the object + //earlier they are not anymore part of the toplevel inventor node. we need to check for that. if (d->_editViewProvider == ChildViewProvider) resetEdit(); - //remove the viewprovider serves the purpose of detaching the inventor nodes from the - //top level root in the viewer. However, if some of the children were grouped beneath the object - //earlier they are not anymore part of the toplevel inventor node. we need to check for that. - if(activeView->getViewer()->hasViewProvider(ChildViewProvider)) - activeView->getViewer()->removeViewProvider(ChildViewProvider); + activeView->getViewer()->removeViewProvider(ChildViewProvider); } } }