Changeset 222 for trunk/nom


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.

Location:
trunk/nom
Files:
3 edited

Legend:

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

    r221 r222  
    8989  mtab=g_datalist_get_data(&_gdataClassList, className);
    9090
    91   nomPrintf("-----> %s %s %x\n", __FUNCTION__, className, mtab);
     91  //nomPrintf("-----> %s %s %x\n", __FUNCTION__, className, mtab);
    9292
    9393  if(mtab){
     
    225225}
    226226
     227/**
     228   \brief Function which implements the nomSubstituteClass() method of NOMClassMgr.
     229 */
     230NOM_Scope CORBA_boolean NOMLINK impl_NOMClassMgr_nomSubstituteClass(NOMClassMgr* nomSelf,
     231                                                                    const CORBA_char * oldClass,
     232                                                                    const CORBA_char * replacementClass,
     233                                                                    CORBA_Environment *ev)
     234{
     235/* NOMClassMgrData* nomThis=NOMClassMgrGetData(nomSelf); */
     236  NOMObject* oClass;
     237  NOMObject* rClass;
     238
     239  if((oClass=_nomFindClassFromName( nomSelf, oldClass, 0, 0, NULLHANDLE))==NULLHANDLE)
     240    return FALSE;
     241
     242  if((rClass=_nomFindClassFromName( nomSelf, replacementClass, 0, 0, NULLHANDLE))==NULLHANDLE)
     243    return FALSE;
     244
     245  /* Save old class object pointer. Hmm, maybe not it's still in the old parentMtab */
     246
     247  /* Change the class object pointer in the nomClassDataStructure */
     248
     249  /* Reregister old class with new mtab in the internal list. Make sure we don't get
     250     a warning by GLib */
     251
     252  return FALSE;
     253}
     254
    227255static
    228256int nomClassMgrCompareFunc(gconstpointer a, gconstpointer b)
  • 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 */
  • trunk/nom/idl/nomclassmanager.idl

    r220 r222  
    153153
    154154  /**
     155     This method substitutes \e oldClass with \e replacementClass. This means that after
     156     replacing whenever class \e oldClass is requested \e replacementClass is returned.
     157     \e oldClassNew() will create \e replacementClass objects etc.
     158
     159     The class \e replacementClass must be a direct subclass of \e oldClass.
     160
     161     \remark Both classes must already be registered with the class manager when calling this
     162     method.
     163
     164     \par How to override
     165     This method is usually not overriden.
     166
     167     \param oldClass The class to be replaced
     168     \param replacementClass The class which will be used instead of \e oldClass
     169     \return TRUE if replacement succeeded.
     170
     171   */
     172  boolean nomSubstituteClass(in string oldClass, in string replacementClass);
     173
     174  /**
    155175     Override of nomInit(). The list of methods and the list of classes are initialized
    156176     in that method. In addition the balanced binary tree for registering mtabs is created.
     
    164184
    165185  /**
    166      The list of registered methods.
     186     The list of registered methods. The method nomGetClassList() can be used to get it.
     187     If doing so be aware that it's the real thing no copy.
    167188   */     
    168   NOMINSTANCEVAR(PGData gdataMethodList);
    169   /**
    170      Balanced binary tree holding the mtabs of all known classes.
     189  NOMINSTANCEVAR(PGData gdataMethodList);
     190
     191  /**
     192     Balanced binary tree holding the mtabs of all known classes. You can't access
     193     this from the outside. It's entirely private to NOMClassMgr.
    171194   */
    172195  NOMINSTANCEVAR(PGTree pClassListTree);
Note: See TracChangeset for help on using the changeset viewer.