Ignore:
Timestamp:
Feb 4, 2007, 10:26:27 AM (19 years ago)
Author:
cinc
Message:

Remove finalizer from object before deleting it using delete(). Some other minor changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/class_c/nomobj.c

    r219 r222  
    4545
    4646#include "nomobj.ih"
     47
     48#include "gc.h"
    4749
    4850/**
     
    9597{
    9698/* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */
     99  GC_PTR oldData;
     100  GC_finalization_proc oldFinalizerFunc;
     101  NOMClassPriv *ncp;
     102
     103  /* Unregister finalizer if the class uses nomUnInit. This is done so nomUnInit isn't
     104     called again when the memory is eventually collected by the GC. */
     105  ncp=(NOMClassPriv*)nomSelf->mtab->nomClsInfo;
     106  if(ncp->ulClassFlags & NOM_FLG_NOMUNINIT_OVERRIDEN){
     107    /* A NULL finalizer function removes the finalizer */
     108    GC_register_finalizer(nomSelf,  NULL, NULL, &oldFinalizerFunc, &oldData);
     109  }
    97110
    98111  /* Give object the chance to free resources */
Note: See TracChangeset for help on using the changeset viewer.