* include/gc_cpp.h (gc_cleanup::~gc_cleanup): If GC_base(this) returns
null (could be if the object is not allocated dynamically) then do not
call GC_register_finalizer_ignore_self.
inline gc_cleanup::~gc_cleanup()
{
- GC_register_finalizer_ignore_self(GC_base(this), 0, 0, 0, 0);
+ void* base = GC_base(this);
+ if (0 == base) return; // Non-heap object.
+ GC_register_finalizer_ignore_self(base, 0, 0, 0, 0);
}
inline void GC_CALLBACK gc_cleanup::cleanup(void* obj, void* displ)