Branch: Tag:

2000-10-01

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

allow access to parent objects from prog->exit (oracle module requires this)

Rev: src/interpret.c:1.143
Rev: src/object.c:1.109
Rev: src/object.h:1.41
Rev: src/program.c:1.228

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.227 2000/09/29 19:02:59 hubbe Exp $"); + RCSID("$Id: program.c,v 1.228 2000/10/01 08:55:04 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
4057:   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);       return loc.o->storage + loc.inherit->storage_offset;   } -  +