mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0024276: Memory leak due to a static variable
Cleaning of selected entities to avoid a memory leak.
This commit is contained in:
parent
fd4a696350
commit
30bf45dc70
@ -149,6 +149,9 @@ myIsAutoActivateSelMode( Standard_True )
|
|||||||
|
|
||||||
void AIS_InteractiveContext::Delete() const
|
void AIS_InteractiveContext::Delete() const
|
||||||
{
|
{
|
||||||
|
//Clear the static current selection. Else the memory
|
||||||
|
//is not release
|
||||||
|
AIS_Selection::ClearCurrentSelection();
|
||||||
#ifdef OCC172
|
#ifdef OCC172
|
||||||
// to avoid an exception
|
// to avoid an exception
|
||||||
if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
|
if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
|
||||||
|
@ -87,6 +87,8 @@ is
|
|||||||
---Purpose:
|
---Purpose:
|
||||||
returns mutable Selection from AIS;
|
returns mutable Selection from AIS;
|
||||||
|
|
||||||
|
ClearCurrentSelection(myclass);
|
||||||
|
---Purpose: Clears selection.
|
||||||
|
|
||||||
Select(myclass);
|
Select(myclass);
|
||||||
---Purpose: removes all the object of the currentselection.
|
---Purpose: removes all the object of the currentselection.
|
||||||
|
@ -50,9 +50,10 @@
|
|||||||
#define MaxSizeOfResult 100000
|
#define MaxSizeOfResult 100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//current selection (handle)
|
||||||
|
static Handle(AIS_Selection) theCurrentSelection;
|
||||||
static void AIS_Sel_CurrentSelection (Handle(AIS_Selection)& InputSel)
|
static void AIS_Sel_CurrentSelection (Handle(AIS_Selection)& InputSel)
|
||||||
{
|
{
|
||||||
static Handle(AIS_Selection) theCurrentSelection;
|
|
||||||
if(!InputSel.IsNull())
|
if(!InputSel.IsNull())
|
||||||
theCurrentSelection = InputSel;
|
theCurrentSelection = InputSel;
|
||||||
else
|
else
|
||||||
@ -418,6 +419,11 @@ void AIS_Selection::Remove(const Standard_CString aName)
|
|||||||
#endif
|
#endif
|
||||||
AIS_Sel_GetSelections().Remove(I);
|
AIS_Sel_GetSelections().Remove(I);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean the static current selection handle
|
||||||
|
void AIS_Selection::ClearCurrentSelection()
|
||||||
|
{
|
||||||
|
theCurrentSelection.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1061,6 +1061,19 @@ Standard_Integer Visual3d_ViewManager::Identification (const Handle(Visual3d_Vie
|
|||||||
|
|
||||||
void Visual3d_ViewManager::UnIdentification (const Standard_Integer aViewId)
|
void Visual3d_ViewManager::UnIdentification (const Standard_Integer aViewId)
|
||||||
{
|
{
|
||||||
|
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
|
||||||
|
while (MyIterator.More())
|
||||||
|
{
|
||||||
|
if ((MyIterator.Value())->Identification () == aViewId)
|
||||||
|
{
|
||||||
|
const Handle(Visual3d_View)& theView = MyIterator.Value();
|
||||||
|
//remove the view from the list
|
||||||
|
MyDefinedView.Remove(theView);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// go to next
|
||||||
|
MyIterator.Next ();
|
||||||
|
}
|
||||||
MyViewGenId.Free(aViewId);
|
MyViewGenId.Free(aViewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user