1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-07 18:30:55 +03:00

0024294: Access violation in AIS_InteractiveContext::MoveTo()

This commit is contained in:
kgv 2013-10-28 16:25:28 +04:00 committed by bugmaster
parent f24125b9e5
commit be6e564e79

@ -32,10 +32,6 @@
// DetectedCurrentShape(),DetectedCurrentObject() // DetectedCurrentShape(),DetectedCurrentObject()
// methods // methods
#define IMP191001 //GG Avoid to raise when switching with the
// SetAutomaticHilight() method.
// Thanks to IFO of SAMTECH company for this improvment.
#define OCC138 //VTN Avoding infinit loop in AddOrRemoveCurrentObject method. #define OCC138 //VTN Avoding infinit loop in AddOrRemoveCurrentObject method.
#define OCC9657 #define OCC9657
@ -220,43 +216,40 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
// method call. As result it is necessary to rehighligt it with mySelectionColor. // method call. As result it is necessary to rehighligt it with mySelectionColor.
if (!myLastPicked.IsNull()) if (!myLastPicked.IsNull())
{ {
Standard_Integer HiMod = Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
if (myLastPicked->State() != 1) if (myLastPicked->State() != 1)
{ {
pmgr->Unhighlight( myLastPicked, HiMod ); pmgr->Unhighlight (myLastPicked, aHiMod);
UpdVwr = Standard_True; UpdVwr = Standard_True;
} }
else if (myToHilightSelected) else if (myToHilightSelected)
{ {
pmgr->Color( myLastPicked, mySelectionColor, HiMod ); pmgr->Color (myLastPicked, mySelectionColor, aHiMod);
UpdVwr = Standard_True; UpdVwr = Standard_True;
} }
} }
// Initialize myLastPicked field with currently detected object // Initialize myLastPicked field with currently detected object
Handle(SelectMgr_SelectableObject) SO = selector->OnePicked()->Selectable(); myLastPicked = Handle(AIS_InteractiveObject)::DownCast (selector->OnePicked()->Selectable());
myLastPicked = *((Handle(AIS_InteractiveObject)*)&SO);
if ( ismain ) if ( ismain )
myLastinMain = myLastPicked; myLastinMain = myLastPicked;
#ifdef IMP191001
// Highlight detected object if it is not selected or myToHilightSelected flag is true // Highlight detected object if it is not selected or myToHilightSelected flag is true
if ( !myLastPicked.IsNull() && if (!myLastPicked.IsNull()
( myLastPicked->State()!= 1 || myToHilightSelected ) ) && (myLastPicked->State()!= 1 || myToHilightSelected))
#else
if ( myLastPicked->State()!= 1 )
#endif
{ {
Standard_Integer HiMod = Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0; pmgr->Color (myLastPicked, myHilightColor, aHiMod);
pmgr->Color( myLastPicked, myHilightColor, HiMod );
UpdVwr = Standard_True; UpdVwr = Standard_True;
} }
if ( myLastPicked->State()==1 ) if (!myLastPicked.IsNull()
&& myLastPicked->State() == 1)
{
TheStat = AIS_SOD_Selected; TheStat = AIS_SOD_Selected;
} }
}
else else
{ {
// Previously detected object is unhilighted if it is not selected or hilighted // Previously detected object is unhilighted if it is not selected or hilighted
@ -264,16 +257,15 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo(const Standard_Integer XPix
TheStat = AIS_SOD_Nothing; TheStat = AIS_SOD_Nothing;
if (!myLastPicked.IsNull()) if (!myLastPicked.IsNull())
{ {
Standard_Integer HiMod = Standard_Integer aHiMod = myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
myLastPicked->HasHilightMode() ? myLastPicked->HilightMode() : 0;
if (myLastPicked->State() != 1) if (myLastPicked->State() != 1)
{ {
pmgr->Unhighlight( myLastPicked, HiMod ); pmgr->Unhighlight (myLastPicked, aHiMod);
UpdVwr = Standard_True; UpdVwr = Standard_True;
} }
else if (myToHilightSelected) else if (myToHilightSelected)
{ {
pmgr->Color( myLastPicked, mySelectionColor, HiMod ); pmgr->Color (myLastPicked, mySelectionColor, aHiMod);
UpdVwr = Standard_True; UpdVwr = Standard_True;
} }
} }