Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Circular reference conondrum
Message
De
05/08/2005 12:11:30
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Circular reference conondrum
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
SAMBA Server
Database:
MySQL
Divers
Thread ID:
01038909
Message ID:
01038909
Vues:
56
I near the end of implementing something that I probably overengineered to begin with (UML tools can be dangerous in the wrong hands). I know I should go back and re-engineer it, but I'm close to done, and I really NEED to be done.

For reasons that will probably turn out to be frivolous, I have objects that work something like this:
DEFINE CLASS Dad AS Custom
  oMyBoy= .NULL.

  FUNCTION init
    oMyBoy = createObject("Bobby")
    oMyBoy.oMyDad = This
  ENDFUNC

ENDDEFINE

DEFINE CLASS Bobby AS Custom
  oMyDad = .NULL.
ENDDEFINE

oDad = createObject("Dad")
...which works fine for my nefarous purposes, however, it also has an ugly problem when you want to release oDad.

RELEASE oDad releases the reference oDad, but it leaves Dad and son floating around out there with no external reference...the oMyBoy.oMyDad Reference sustains it. I know its still out there, because stuff in destroy() doesnt run until I do a CLEAR ALL

I currently have a function that nulls the inside references (the actual construct is a tree), but having to call this before releasing the object is very bothersome to me. I would be embarrased to have somebody see it in my code.

I could live with putting my call to null the references in destroy(), but it appears destroy won't fire until all the references are cleared.

Does anybody know of a method I could stick my reference nuller in that fires when the external reference is released?

TIA

Russ
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform