Z
ZorpiedoMan
This is either a bad bug, or I'm not understanding
somthing. In my mind, this should NOT work:
------------------------------------------
Class ShouldntWork
Delegate Sub goHere()
Sub StartHere()
Dim DC as new DeadClass
Dim myDel as New goHere(AddressOf DeadClass.Here)
DC = Nothing
GC.Collect
myDel.Invoke
End Sub
End Class
Class DeadClass
Sub Here
MsgBox "How Did I Get Here?"
End Sub
End Class
--------------------------------------
I'm assuming that since a delegate is really just a
pointer to a place in memory, that invoking it still sends
us there, but isn't this dangerous? Assume that that
location on the heap has been overwritten, who knows what
will happen, right?
Comments, Please!
somthing. In my mind, this should NOT work:
------------------------------------------
Class ShouldntWork
Delegate Sub goHere()
Sub StartHere()
Dim DC as new DeadClass
Dim myDel as New goHere(AddressOf DeadClass.Here)
DC = Nothing
GC.Collect
myDel.Invoke
End Sub
End Class
Class DeadClass
Sub Here
MsgBox "How Did I Get Here?"
End Sub
End Class
--------------------------------------
I'm assuming that since a delegate is really just a
pointer to a place in memory, that invoking it still sends
us there, but isn't this dangerous? Assume that that
location on the heap has been overwritten, who knows what
will happen, right?
Comments, Please!