Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Wishlist???
Message
 
À
06/09/1999 08:07:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00260725
Message ID:
00261748
Vues:
49
Jim,

I disagree that my approach is taking advantage of an undocumented feature or behavior. My application object has a GetHook method. The mehtod is called to get a reference to a ultility object (of which there may be many different ones). The emthod first checks to see if the object requested exists already and if it does it returns a reference to it, if not it creates one and returns the reference.

The caller may be storing its reference in a property or a variable. This can and does (by design) create situations where multiple objects each have a reference to the same utility object. If one of those objects decides to clean up its memory and release the variable that references the utility object, with your porposed change, all other objects using that utility object would be suseptable to crashing because the utility object disappears.

The application object never releases the utility object until system shut down because some other object may request it. IOW, the application object pools references to the utility objects so they are created once and used many times.

It just does not make sense that releasing one variable should have any effect on other variables.

The release method is another question altogether. Although I believe that dangling references are usually because the developer forgot something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform