I understand the basics of reference counting but I am having trouble getting my head around one possibility.
What happens while a class function/method is running - suppose the class instance removes the last reference to itself while executing - how does that get dealt with internally and is it dangerous?
Perhaps while a class’ function is running a temporary extra reference is held or else the garbage collector is otherwise not allowed to delete it.
e.g.
class Something
{
[INDENT]function DoSomething
{
[INDENT]call an external function that removes last reference to this instance
some more code - (this still executes)
[/INDENT]}
[/INDENT]}