Interface ISessionObjects
The object lifetime manager of an execution session: creates instances and tracks their roots and reference counts.
public interface ISessionObjects
Methods
AddRef(VBRuntimeObjectId, IBindingHandle)
Records a new reference (root) to an instance.
void AddRef(VBRuntimeObjectId instance, IBindingHandle handle)
Parameters
instanceVBRuntimeObjectIdhandleIBindingHandle
AttachEventHandlers(VBRuntimeObjectId, VBRuntimeObjectId, Symbol)
Records that variable, a WithEvents variable of subscriber, now holds
source, so that the procedures of the subscriber's class that handle events of the variable
handle those of the source (MS-VBAL §5.4.3.9).
void AttachEventHandlers(VBRuntimeObjectId source, VBRuntimeObjectId subscriber, Symbol variable)
Parameters
sourceVBRuntimeObjectIdsubscriberVBRuntimeObjectIdvariableSymbol
Remarks
A source's handlers are in the order their variables were assigned, so one that is already attached is moved to the end of that order: it is the last to handle an event raised from now on (MS-VBAL §5.4.2.20).
CreateObject()
Creates a new object instance and returns its identity.
VBRuntimeObjectId CreateObject()
Returns
DetachEventHandlers(VBRuntimeObjectId, VBRuntimeObjectId, Symbol)
Records that variable of subscriber no longer holds
source: its handlers no longer handle the source's events.
void DetachEventHandlers(VBRuntimeObjectId source, VBRuntimeObjectId subscriber, Symbol variable)
Parameters
sourceVBRuntimeObjectIdsubscriberVBRuntimeObjectIdvariableSymbol
DetachSubscriber(VBRuntimeObjectId)
Detaches every handler of subscriber, from every source: it is being destroyed, and nothing
of it can handle an event any more.
void DetachSubscriber(VBRuntimeObjectId subscriber)
Parameters
subscriberVBRuntimeObjectId
EventSubscribers(VBRuntimeObjectId)
The subscriptions that handle the events of source, in the order they were attached.
IReadOnlyList<EventSubscription> EventSubscribers(VBRuntimeObjectId source)
Parameters
sourceVBRuntimeObjectId
Returns
IsHeldBy(VBRuntimeObjectId, IBindingHandle)
Whether handle is one of the roots currently holding a reference to an instance.
bool IsHeldBy(VBRuntimeObjectId instance, IBindingHandle handle)
Parameters
instanceVBRuntimeObjectIdhandleIBindingHandle
Returns
RefCount(VBRuntimeObjectId)
The number of references currently held to an instance; 0 for one that is not live.
int RefCount(VBRuntimeObjectId instance)
Parameters
instanceVBRuntimeObjectId
Returns
RemoveRef(VBRuntimeObjectId, IBindingHandle)
Drops a reference to an instance and returns the remaining reference count.
int RemoveRef(VBRuntimeObjectId instance, IBindingHandle handle)
Parameters
instanceVBRuntimeObjectIdhandleIBindingHandle
Returns
TryBeginTerminate(VBRuntimeObjectId)
Records that Terminate is about to run for an instance (MS-VBAL §5.3.1.10: at most once
during an object's lifetime, however often it becomes a candidate for destruction).
bool TryBeginTerminate(VBRuntimeObjectId instance)
Parameters
instanceVBRuntimeObjectId
Returns
TryRemoveObject(VBRuntimeObjectId)
Removes an instance whose reference count has reached zero.
bool TryRemoveObject(VBRuntimeObjectId instance)
Parameters
instanceVBRuntimeObjectId