From: apo Date: Fri, 28 Sep 2007 04:23:40 +0000 (+0000) Subject: Fix for Bug NPAL17044 X-Git-Tag: V3_2_8~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b410091aa9e34d36190d4649cd6741fcff8f15c4;p=modules%2Fgui.git Fix for Bug NPAL17044 Attempt to access null object on VISU. This regression has come from fix for Bug NPAL16771. --- diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index a3b0b526d..ead47cbbc 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -44,13 +44,13 @@ */ inline SALOME_Actor* -GetFirstSALOMEActor(vtkActorCollection* theCollection) +GetLastSALOMEActor(vtkActorCollection* theCollection) { if (theCollection) { for (int i = theCollection->GetNumberOfItems() - 1; i >= 0; i--) { - SALOME_Actor* anActor = dynamic_cast(theCollection->GetItemAsObject(i)); - if (anActor) - return anActor; + if (SALOME_Actor* anActor = dynamic_cast(theCollection->GetItemAsObject(i))) + if (anActor->hasIO()) + return anActor; } } return NULL; @@ -554,7 +554,7 @@ SVTK_SelectorDef theRenderer); vtkActorCollection* aListActors = myCellPicker->GetActors(); - SALOME_Actor* anActor = GetFirstSALOMEActor(aListActors); + SALOME_Actor* anActor = GetLastSALOMEActor(aListActors); if (! anActor) { myPicker->Pick(theEvent->myX, @@ -562,7 +562,7 @@ SVTK_SelectorDef 0.0, theRenderer); aListActors = myPicker->GetActors(); - anActor = GetFirstSALOMEActor(aListActors); + anActor = GetLastSALOMEActor(aListActors); } return anActor;