Cleaning of selected entities to avoid a memory leak.
void AIS_InteractiveContext::Delete() const
{
+ //Clear the static current selection. Else the memory
+ //is not release
+ AIS_Selection::ClearCurrentSelection();
#ifdef OCC172
// to avoid an exception
if ( AIS_Selection::Find( mySelectionName.ToCString() ) )
---Purpose:
returns mutable Selection from AIS;
+ ClearCurrentSelection(myclass);
+ ---Purpose: Clears selection.
Select(myclass);
---Purpose: removes all the object of the currentselection.
#define MaxSizeOfResult 100000
#endif
+//current selection (handle)
+static Handle(AIS_Selection) theCurrentSelection;
static void AIS_Sel_CurrentSelection (Handle(AIS_Selection)& InputSel)
{
- static Handle(AIS_Selection) theCurrentSelection;
if(!InputSel.IsNull())
theCurrentSelection = InputSel;
else
#endif
AIS_Sel_GetSelections().Remove(I);
}
-
+}
+
+// clean the static current selection handle
+void AIS_Selection::ClearCurrentSelection()
+{
+ theCurrentSelection.Nullify();
}
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);
}