Can I destroy a class instance even if there are still references?
Posted
by DR
on Stack Overflow
See other posts from Stack Overflow
or by DR
Published on 2010-06-01T07:13:31Z
Indexed on
2010/06/01
7:43 UTC
Read the original article
Hit count: 258
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?
© Stack Overflow or respective owner