Can I destroy a class instance even if there are still references?
- by DR
For debugging reasons I want to destroy a class instance which still as references. Is that possible? It doesn't have to be elegant or stable, because this'll never end up in production code.
To clarify:
Public Sub Main
Dim o as MyClass
Set o = New MyClass //o is created, one reference
DestroyObject o //Class_Terminate is called and the object destroyed
//Further code, not using o
End Sub //Possible runtime error here (don't care)
Is that possible? One way would be to call IUnknown::Release to manually decrease the reference count, but how do I now how often I must call it?