Branch: Tag:

2001-10-15

2001-10-15 09:20:58 by Martin Stjernholm <mast@lysator.liu.se>

Fixed [bug 2400 (#2400)] where the gc in RTL-debug mode dumped core if an
array in a gc cycle contained a reference to a destructed object.
Without RTL-debug the only effect was that the type hint would lack
BIT_INT.

Rev: src/array.c:1.120

23:   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.119 2001/09/25 05:55:09 hubbe Exp $"); + RCSID("$Id: array.c,v 1.120 2001/10/15 09:20:58 mast Exp $");      PMOD_EXPORT struct array empty_array=   {
2137:       if (a->type_field & BIT_COMPLEX)    { -  if (a->flags & ARRAY_WEAK_FLAG) { -  if (gc_cycle_check_weak_svalues(ITEM(a), a->size)) { - #ifdef PIKE_DEBUG -  fatal("Didn't expect an svalue zapping now.\n"); - #endif -  } -  gc_assert_checked_as_weak(a); -  } -  else { -  TYPE_FIELD t; -  if ((t = gc_cycle_check_svalues(ITEM(a), a->size))) { +  TYPE_FIELD t = a->flags & ARRAY_WEAK_FLAG ? +  gc_cycle_check_weak_svalues(ITEM(a), a->size) : +  gc_cycle_check_svalues(ITEM(a), a->size); +  if (t) { +  /* In the weak case we should only get here if references to +  * destructed objects are removed. */    if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1)    a->type_field = t;    else    a->type_field |= t;    } -  + #ifdef PIKE_DEBUG +  if (a->flags & ARRAY_WEAK_FLAG) +  gc_assert_checked_as_weak(a); +  else    gc_assert_checked_as_nonweak(a); -  + #endif    } -  } +     } GC_CYCLE_LEAVE;   }