Branch: Tag:

2007-05-13

2007-05-13 15:42:06 by Martin Stjernholm <mast@lysator.liu.se>

More accurate checking of live C objects when the compat event handler is
used. Always check for live C objects, not only when gc_destruct_everything
is set.

Rev: src/gc.c:1.282
Rev: src/gc.h:1.126

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gc.c,v 1.281 2007/05/13 14:55:26 mast Exp $ + || $Id: gc.c,v 1.282 2007/05/13 15:42:06 mast Exp $   */      #include "global.h"
2313:    move_marker (m, debug_malloc_pass (new));   }    + int gc_object_is_live (struct object *o) + { +  extern void compat_event_handler(int e); +  struct program *p = o->prog; +  if (!p) return 0; +  if (FIND_LFUN (p, LFUN_DESTROY) != -1) return 1; +  if (!p->event_handler) return 0; +  if (p->event_handler != compat_event_handler) +  /* Unknown handler - have to assume it might act on PROG_EVENT_EXIT. */ +  return 1; +  return !!((void (**) (struct object *)) p->program)[PROG_EVENT_EXIT]; + } +    PMOD_EXPORT void gc_cycle_enqueue(gc_cycle_check_cb *checkfn, void *data, int weak)   {    struct link_frame *l = alloc_link_frame();