Object removing own last reference.
strtr
strtr at sp.am
Fri Jun 25 10:48:21 PDT 2010
== Quote from Simen kjaeraas (simen.kjaras at gmail.com)'s article
> strtr <strtr at sp.am> wrote:
> >
> > void externalFunc(){}
> >
> > class C
> > {
> > ..
> > int index_;
> > int yay;
> > void removeMe()
> > {
> > //remove last reference to this object
> > objects[_index] = null;
> >
> > //other critical code
> > memberFunc();
> > externalFunc();
> > }
> > void memberFunc(){yay++}
> > }
> >
> > Is there anything unsafe about his code? Like the GC removing the Object
> > before calling memberFunc..
> A reference to it will still be on the stack, so it should be no problem.
The "this" marksibly mentioned. Thanks peoples ;)
More information about the Digitalmars-d-learn
mailing list