Fix crash from unviewed parametrized datum plane

This commit is contained in:
Enmar Abrams 2016-04-27 00:17:48 -04:00 committed by wmayer
parent 76ce101a9b
commit c12c4368cc

View File

@ -87,9 +87,9 @@ ViewProviderDatum::ViewProviderDatum()
pShapeSep->ref(); pShapeSep->ref();
pPickStyle = new SoPickStyle(); pPickStyle = new SoPickStyle();
pPickStyle->ref(); pPickStyle->ref();
DisplayMode.setStatus(App::Property::Hidden, true); DisplayMode.setStatus(App::Property::Hidden, true);
// set default color for datums (golden yellow with 60% transparency) // set default color for datums (golden yellow with 60% transparency)
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ( ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath (
"User parameter:BaseApp/Preferences/Mod/PartDesign"); "User parameter:BaseApp/Preferences/Mod/PartDesign");
@ -349,15 +349,19 @@ SbBox3f ViewProviderDatum::getRelevantBoundBox () const {
} }
} }
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(this->getActiveView())->getViewer(); Gui::View3DInventor* view = dynamic_cast<Gui::View3DInventor*>(this->getActiveView());
SoGetBoundingBoxAction bboxAction(viewer->getSoRenderManager()->getViewportRegion()); if(view){
SbBox3f bbox = getRelevantBoundBox (bboxAction, objs); Gui::View3DInventorViewer* viewer = view->getViewer();
SoGetBoundingBoxAction bboxAction(viewer->getSoRenderManager()->getViewportRegion());
SbBox3f bbox = getRelevantBoundBox (bboxAction, objs);
if ( bbox.getVolume () < Precision::Confusion() ) { if ( bbox.getVolume () < Precision::Confusion() ) {
bbox.extendBy ( defaultBoundBox () ); bbox.extendBy ( defaultBoundBox () );
}
return bbox;
} else {
return defaultBoundBox();
} }
return bbox;
} }
SbBox3f ViewProviderDatum::getRelevantBoundBox ( SbBox3f ViewProviderDatum::getRelevantBoundBox (