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

0028888: Visualization - AIS_InteractiveContext should not hold V3d_View handle which will cause accessing invalid removed V3d_View

This commit is contained in:
kgv 2017-07-04 14:15:34 +03:00 committed by bugmaster
parent 33ba856502
commit 4679d975dc
5 changed files with 19 additions and 9 deletions

View File

@ -1863,7 +1863,6 @@ protected:
Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
AIS_DataMapOfILC myLocalContexts;
Standard_Integer myCurLocalIndex;
Handle(V3d_View) mylastmoveview;
TColStd_SequenceOfInteger myDetectedSeq;
Standard_Integer myCurDetected;
Standard_Integer myCurHighlighted;

View File

@ -422,7 +422,6 @@ AIS_StatusOfDetection AIS_InteractiveContext::MoveTo (const Standard_Integer th
theView->Viewer()->Update();
}
mylastmoveview = theView;
return aStatus;
}

View File

@ -60,12 +60,12 @@ OpenLocalContext(const Standard_Boolean UseDisplayedObjects,
const Handle(AIS_InteractiveObject) aLastPickedAIS = Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable());
unhighlightGlobal (aLastPickedAIS);
}}
if(!mylastmoveview.IsNull()){
if(myCurLocalIndex>0)
myLocalContexts(myCurLocalIndex)->UnhilightLastDetected(mylastmoveview);
if (myCurLocalIndex > 0)
{
myLocalContexts (myCurLocalIndex)->UnhilightLastDetected (myMainVwr);
}
// entities connected to dynamic selection at neutral point are set to 0.
myLastinMain.Nullify();

View File

@ -164,7 +164,10 @@ public:
Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate);
//! returns True if something was done...
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& aView);
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_Viewer)& theViewer);
//! returns True if something was done...
Standard_EXPORT Standard_Boolean UnhilightLastDetected (const Handle(V3d_View)& theView);
//! returns the number of selected
Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);

View File

@ -1362,6 +1362,15 @@ Standard_Integer AIS_LocalContext::HilightPreviousDetected (const Handle(V3d_Vie
//purpose :
//=======================================================================
Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)& theView)
{
return UnhilightLastDetected (theView->Viewer());
}
//=======================================================================
//function : UnhilightLastDetected
//purpose :
//=======================================================================
Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_Viewer)& theViewer)
{
if (!IsValidIndex (mylastindex))
{
@ -1371,7 +1380,7 @@ Standard_Boolean AIS_LocalContext::UnhilightLastDetected (const Handle(V3d_View)
myMainPM->BeginImmediateDraw();
const Handle(SelectMgr_EntityOwner)& anOwner = myMapOfOwner->FindKey (mylastindex);
anOwner->Unhilight (myMainPM);
myMainPM->EndImmediateDraw (theView->Viewer());
myMainPM->EndImmediateDraw (theViewer);
mylastindex = 0;
return Standard_True;
}