Destroy
(Available in 01 TS COM - TS_COM_IUnknown)
Purpose
CALLBACK: This method will automaticly be called on the last 'Release()' call. Note: Never call this method directly, It will alwais be called on the last 'Release()'.
Syntax
// See the documentation for the 'Release()' method.
oSomeIClass:Release( )
Description
This is where the application releases all refered to dynamicly allocated resources ( ARRAY, OBJECT, STRING ), and where all staticaly allocated memory is freed.
Note: Do not execute the 'Destroy()' method directly, it is adviced to call the 'Release()' method when destruction of the object is needed this method of destruction is optimized for speed and guaranties that the 'Destroy()' method is only called once.
Note: The designer of the class should be aware of the fact that the 'Destroy()' method can be called multiple times.
Note: Never call this method directly, It will alwais be called on the last 'Release()'.
Example
METHOD Destroy( ) CLASS SomeIClass
// Let it be known that we are destroying the object
SELF:IsInDestroy:=TRUE
// Do the destructive work
...
// All work should be done before calling SUPER
SUPER:Destroy( )
RETURN NIL
Source
METHOD Destroy( ) CLASS TS_IUnknown
LOCAL ppIOwnedsArrayPP AS PTR PTR
LOCAL dwIOwnedsCount AS DWORD
LOCAL oIOwned AS TS_IUnknown
LOCAL oIIDs AS TS_PointerSafe
LOCAL X AS DWORD
TSTrace Enter
SELF:_ObjectStat1:=_OR( SELF:_ObjectStat1 ; ...
... , TS_OBJSTAT1_INDESTROY )
ppIOwnedsArrayPP:=SELF:_IOwnedsArrayPP
IF ppIOwnedsArrayPP<>NULL_PTR
SELF:_IOwnedsArrayPP:=NULL_PTR
SELF:_IOwnedsMax:=0
dwIOwnedsCount:=SELF:_IOwnedsCount
IF dwIOwnedsCount>0U
SELF:_IOwnedsCount:=0U
FOR X:=dwIOwnedsCount