Branch: Tag:

2000-10-01

2000-10-01 08:51:54 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

allow parent access from prog->exit()

Rev: src/interpret.c:1.172
Rev: src/object.c:1.150
Rev: src/object.h:1.55
Rev: src/program.c:1.274

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.273 2000/09/26 00:17:47 hubbe Exp $"); + RCSID("$Id: program.c,v 1.274 2000/10/01 08:51:54 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
4407:   PMOD_EXPORT void *parent_storage(int depth)   {    struct external_variable_context loc; +  struct program *p;    -  +     loc.o=Pike_fp->current_object; -  if(!loc.o->prog) +  p=loc.o->prog; +  if(!p) +  { +  /* magic fallback */ +  p=get_program_for_object_being_destructed(loc.o); +  if(!p) +  {    error("Cannot access parent of destructed object.\n"); -  +  } +  }       loc.parent_identifier=Pike_fp->fun; -  loc.inherit=INHERIT_FROM_INT(loc.o->prog, Pike_fp->fun); +  loc.inherit=INHERIT_FROM_INT(p, Pike_fp->fun);       find_external_context(&loc, depth);