A server object is required by COM to maintain a reference count on a per-object (not per-interface) basis. Dolphin’s COM framework provides this functionality for you. A natural place to implement it would be in COMInterfaceImp, but to avoid requiring that all COM server objects be subclassed from a particular class (an undesirable limitation in a language with only single-inheritance), reference count based lifetime management and the basic mechanics for QueryInterface,and aggregation, are provided by a separate class, COMObjectStub. Instances of COMObjectStub act as proxies that sit between the actual server implementation class and the clients. They receive all virtual function calls: AddRef and Release are handled locally, QueryInterface is handled locally with support from the server object (via its implentation of #queryInterface:[ifNone:]), and invocations of other interface methods are forwarded as Smalltalk messages to the server objects.
COMObjectStub will keep a server object alive for as long as there are references to COM interfaces onto it. When the reference count that it maintains drops to zero it informs the server object by sending it the #finalRelease message, and then removes itself from the table of live stubs.