Bug IPAL21436 - TC5.1.3 Call of Pop-up onLocal Coordinate System is Attempt to access to null object, SIGSEGV. Regress

This commit is contained in:
ouv 2009-10-23 08:51:26 +00:00
parent 94006657e9
commit 11144d3576
2 changed files with 49 additions and 46 deletions

View File

@ -511,18 +511,18 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
SVTK_Prs* vtkPrs = SVTK_Prs* vtkPrs =
stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0; stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0;
if ( vtkPrs && !vtkPrs->IsNull() ) { if ( vtkPrs && !vtkPrs->IsNull() ) {
if ( mode == 0 ) if ( mode == 0 )
aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() );
else if ( mode == 1 ) else if ( mode == 1 )
aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() );
else if ( mode == 2 ) { else if ( mode == 2 ) {
vtkActorCollection* anActors = vtkPrs->GetObjects(); vtkActorCollection* anActors = vtkPrs->GetObjects();
anActors->InitTraversal(); anActors->InitTraversal();
while (vtkActor* anAct = anActors->GetNextActor()) { while (vtkActor* anAct = anActors->GetNextActor()) {
GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode()); aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode());
} }
} }
} }
} }
aView->Repaint(); aView->Repaint();
@ -538,19 +538,21 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel()); SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel());
SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( It.Value()->getEntry() ) ); SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( It.Value()->getEntry() ) );
if ( occPrs && !occPrs->IsNull() ) { if ( occPrs && !occPrs->IsNull() ) {
AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
AIS_ListIteratorOfListOfInteractive interIter( shapes ); AIS_ListIteratorOfListOfInteractive interIter( shapes );
for ( ; interIter.More(); interIter.Next() ) { for ( ; interIter.More(); interIter.Next() ) {
if ( mode == 0 ) if ( mode == 0 )
ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false );
else if ( mode == 1 ) else if ( mode == 1 )
ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false );
if (mode == 2 ) { if (mode == 2 ) {
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
aSh->SetDisplayVectors(!aSh->isShowVectors()); if ( !aSh.IsNull() ) {
ic->RecomputePrsOnly(interIter.Value()); aSh->SetDisplayVectors(!aSh->isShowVectors());
} ic->RecomputePrsOnly(interIter.Value());
} }
}
}
} }
} }
ic->UpdateCurrentViewer(); ic->UpdateCurrentViewer();

View File

@ -195,28 +195,29 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const
SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
if ( prs ) { if ( prs ) {
if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
SOCC_Prs* occPrs = (SOCC_Prs*) prs; SOCC_Prs* occPrs = (SOCC_Prs*) prs;
AIS_ListOfInteractive lst; AIS_ListOfInteractive lst;
occPrs->GetObjects( lst ); occPrs->GetObjects( lst );
if ( lst.Extent() ) { if ( lst.Extent() ) {
Handle(AIS_InteractiveObject) io = lst.First(); Handle(AIS_InteractiveObject) io = lst.First();
if ( !io.IsNull() ) { if ( !io.IsNull() ) {
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io); Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
ret = aSh->isShowVectors(); if ( !aSh.IsNull() )
} ret = aSh->isShowVectors();
} }
}
} else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK } else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs ); SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0; vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
if ( lst ) { if ( lst ) {
lst->InitTraversal(); lst->InitTraversal();
vtkActor* actor = lst->GetNextActor(); vtkActor* actor = lst->GetNextActor();
if ( actor ) { if ( actor ) {
GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor); GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
if ( aGeomActor ) if ( aGeomActor )
ret = aGeomActor->GetVectorMode(); ret = aGeomActor->GetVectorMode();
} }
} }
} }
} }
} }