Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Forms not releasing themselves or their datasessions
Message
 
À
30/06/1997 22:39:24
Jon Ziegler
Mannesmann Dematic Corp.
Solon, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00036724
Message ID:
00038597
Vues:
47
>>>>>>>>>I am experiencing some extremely frustrating problems in VFP 3.0b. Randomly, forms that I have created within an application will not close... >>>>> >>>>>>>>I'm using Vfp 5.0a here and I'm also facing this problem. What is worse is that it really seems to be randomic (I have never seen such a problem before)... >>>>> >>>>>>It really looks like there are some object references that are still pointing to your object. For this reason, objects remain in memory, but you can usus\ally not talk to them anymore. In VFP3, a construction like this often leads to GPFs too. If that might be the case, then I can give you more advise how to deal with that... >>>>> >>>>>Yes, I have gotten quite a few GPFs... >>>> >>>>There is no easy way to get rid of all object references. As long as you only use variables as pointers, try to make them local so that they go out of scope. Also, a XXX.Release should clean up all the variable references. But it gets more tricky as soon as you use properties as references, because then you can not assume that XXX.Release cleans up everything. >>>> >>>>As a general rule, make sure to clean up all your references by yourself. I know it's a PITA, but... >>> >>>If I encounter the problem from within VFP (not running from the .EXE alone) and I cancel from a menu item which I have setup to do just that, I can enter "CLEAR ALL" in the command window, and that will clear the previously unreleasable form off the screen. If I would just enter "RELEASE ALL" instead of "CLEAR ALL", the form would still be on the screen. I'm trying to figure out what to clear! Still haven't gotten it yet. I've tried all of the "CLEAR " commands alone (aside from "CLEAR ALL") and none of them by themselves seem to make the form disappear. I've also noticed that if I create a form based on the first subclass of my main form baseclass, the problem appears even when the form is completely blank with no tables in the dataenvironment whatsoever and absolutely no controls are on the form. If I were to click the "X" close button of the form, it would not release. So, I think for some reason my form class is to blame. I'm still debugging... >> >>That's def. a pointer problem. You can not clear pointers, you can only release them. Make sure to keep track of all the pointers you create and release them afterwards. > >Actually, after further review of the problem, the toolbar used by all of the forms (I have one common toolbar shared by all the forms in the app) seems to be causing the problem. If I comment out all the code that displays the toolbar, refreshes it, hides it, etc. the forms display properly. > >Also, another interesting tidbit is that if I explicitly call the form's DESTROY() method, the form will disappear from the screen, and if the toolbar code is functional, the toolbar will release as well. However, there is still a variable of the same name as the form, created by VFP, I think, when the DO FORM is issued, that is not released and can't be released. > >I'm not exactly sure what you mean by pointer? Is that something like: frmWhatever.oThisIsThePointer = CREATEOBJECT( "SomeClass" ) ? Yes, that's what I mean when I say "pointer". You are right. The form wíll release when you destroy it. Unfortunately, it gets a bit more complex when some member objects of the form have pointers again... Greetings Markus




Markus Egger
President, EPS Software Corp
Author, Advanced Object Oriented Programming with VFP6
Publisher, CoDe Magazine
Microsoft MVP since 1995
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform