Object removing own last reference.

strtr strtr at sp.am
Thu Jun 24 17:35:07 PDT 2010


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..



More information about the Digitalmars-d-learn mailing list