[DGD] Error with non-persistent objects?

Thomas Conner Annandale gte829m at prism.gatech.edu
Sat Sep 1 06:14:33 CEST 2001


I'm now pretty sure that the Segmentation Faults I've been getting are
DGD's fault, and not caused by my extensions.  Here's a walkthrough of the
(rather weird sequence of events) that I use to reproduce the error...

/* master.c begin */
  mixed m;

  void go1() {
    int i;
    m = allocate(10);
    for(i=0; i<10; i++) {
      m[i] = new_object(find_object("/obj/test"));
      m[i]->set_s("blah la"+i);
    }
  }

  void go2() {
    int i;
    for(i=0; i<10; i++)
      write(typeof(m[i]->get_i())+"\n");
  }

  void go3() {
    compile_object("/obj/test");
  }
/* master.c end */


/* /obj/test.c begin */ 
  string s;
  /*
  int i;
  int get_i() { return i; }
  */
  void set_s(string _s) { s = _s; }
/* /obj/test.c end */


call go3() to compile /obj/test, then call go1() to create 10
non-persistent clones of it.  Then uncomment the commented code in
/obj/test.c and call go3() to compile it again.  call go2() twice, call
go3() again, and then go2() again and you'll see that the values outputted
for typeof() have changed to nonsensical values.  You can use a similar
sequence of steps to get a seg fault (by trying to add get_i() to a
string, I think)


Thomas
www.boredatheist.com


_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list