form.Release not releasing 
Author Message
 form.Release not releasing

Under what conditions could / would / might a call to the Form.Release()
not release the form?
I have a close button on a toolbar that operates this way

IF _screen.ActiveForm.QueryUnload()
   RETURN _screen.ActiveForm.Release()
ENDIF

I know Release() doesn't return anything natively, but it's there for
consistency w/ other buttons, just in case :-)

It's getting to the Release() call, but not going on to the Destroy() -
there is no code in the Release() method.
It is happening after a delete - which seems to be going alright - but, it
only does it if it's the very first thing done - if a form is pulled up,
requeried, added to or edited, saved, the delete will go alright.
--
Trey Walpole

-- For legit e-mail, remove underscores



Tue, 07 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Trey,

The usual reason for a form to not destruct fully is that there is a reference to one of
the contained objects being held by a property or external memvar or object.

df    - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/

Quote:

>Under what conditions could / would / might a call to the Form.Release()
>not release the form?
>I have a close button on a toolbar that operates this way

>IF _screen.ActiveForm.QueryUnload()
>   RETURN _screen.ActiveForm.Release()
>ENDIF

>I know Release() doesn't return anything natively, but it's there for
>consistency w/ other buttons, just in case :-)

>It's getting to the Release() call, but not going on to the Destroy() -
>there is no code in the Release() method.
>It is happening after a delete - which seems to be going alright - but, it
>only does it if it's the very first thing done - if a form is pulled up,
>requeried, added to or edited, saved, the delete will go alright.



Tue, 07 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Trey,

David is right that it is normally an object reference.

I had a customer search form that would sometimes hang.  I traced it to the
form release.  I then place code in the contained objects release methods
and
found that it was getting to a custom container and{*filter*}.  I never was
able
to specifically determine why.  There were no object references that would
be{*filter*} it up.  I finally placed a routine in the release that cycled
through
all the contained objects and released them individually.  This has been
working
without incident for over two months.  Unfortunately I can only offer at a
possible
work-around without providing the why's.

-myron kirby-

===========================

Quote:

>Trey,

>The usual reason for a form to not destruct fully is that there is a
reference to one of
>the contained objects being held by a property or external memvar or
object.

>df    - (Microsoft FoxPro MVP)

http://www.*-*-*.com/
Quote:


>>Under what conditions could / would / might a call to the Form.Release()
>>not release the form?
>>I have a close button on a toolbar that operates this way

>>IF _screen.ActiveForm.QueryUnload()
>>   RETURN _screen.ActiveForm.Release()
>>ENDIF

>>I know Release() doesn't return anything natively, but it's there for
>>consistency w/ other buttons, just in case :-)

>>It's getting to the Release() call, but not going on to the Destroy() -
>>there is no code in the Release() method.
>>It is happening after a delete - which seems to be going alright - but, it
>>only does it if it's the very first thing done - if a form is pulled up,
>>requeried, added to or edited, saved, the delete will go alright.



Wed, 08 Nov 2000 03:00:00 GMT  
 form.Release not releasing

That's what I thought - but this doesn't make it to the form's Destroy() -
the form's Destroy() is the first Destroy() that happens, right?  I've got
all the object references releasing in the parent object's Destroy()
(whether it be a form or another container).  Should those object releases
be called from the form's Release() instead??
I did coverage logs - one when I knew it would go correctly (i.e., actually
release) and one that would fail.
The one that failed didn't even hit the form's Destroy() at all.
This has been working for well over a year w/o incident.  The only time it
happens is if the first thing you do is Delete a record.  I can run my EXE
and pull up a form, edit a record, pull up another form and delete a record
and the form will close.  If I run my EXE and pull up a form and delete a
record first thing, the form will not close.
If I run VFP and DO MAIN to run the app, the same thing happens - unless DO
MAIN was not the first thing I did while in VFP -- then the form will
close.  Didja get that? :-)  It's confusing the bejeezus out of me.
Thanks for the input.
--
Trey Walpole

-- For legit e-mail, remove underscores



Quote:
> Trey,

> The usual reason for a form to not destruct fully is that there is a
reference to one of
> the contained objects being held by a property or external memvar or

object.


Sat, 11 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Trey,

Are you using pemstatus() and/or getpem() these two functions can under some conditions
leave internal object references{*filter*} which will prevent an object from destructing. If
not then you have to find out what is going on the  delete code that is creating a
reference to the object.

df    - (Microsoft FoxPro MVP) http://www.*-*-*.com/

Quote:

>That's what I thought - but this doesn't make it to the form's Destroy() -
>the form's Destroy() is the first Destroy() that happens, right?  I've got
>all the object references releasing in the parent object's Destroy()
>(whether it be a form or another container).  Should those object releases
>be called from the form's Release() instead??
>I did coverage logs - one when I knew it would go correctly (i.e., actually
>release) and one that would fail.
>The one that failed didn't even hit the form's Destroy() at all.
>This has been working for well over a year w/o incident.  The only time it
>happens is if the first thing you do is Delete a record.  I can run my EXE
>and pull up a form, edit a record, pull up another form and delete a record
>and the form will close.  If I run my EXE and pull up a form and delete a
>record first thing, the form will not close.
>If I run VFP and DO MAIN to run the app, the same thing happens - unless DO
>MAIN was not the first thing I did while in VFP -- then the form will
>close.  Didja get that? :-)  It's confusing the bejeezus out of me.
>Thanks for the input.



Sat, 11 Nov 2000 03:00:00 GMT  
 form.Release not releasing

--
Brett Slattery

Myron,
Do you use this routine (cycling through and releasing each object) to
release all your forms?  

I also have experienced a lot of problems with forms not releasing.
Especially after an error occurs. I have to go to the command window and
type CLEAR ALL for the form to go away. When I LIST MEMO, the only object I
see is the name of my FORM shown as a WINDOW object. I try RELEASE WINDOW
MYWINDOW, etc. and nothing seems to work. I want something more bulletproof
for my distributed products. So inserting a standard routine to cycle
through all objects looks pretty good right now if it's reliable.

Is this what you would recommend?



Quote:
>  I finally placed a routine in the release that cycled  through all the

contained objects and released them individually.  This has been working
without incident for over two months.  Unfortunately I can only offer at a
possible  work-around without providing the why's.


Sun, 12 Nov 2000 03:00:00 GMT  
 form.Release not releasing

No, I only use this methodology on one specific form.  In theory this should
not be required, but after X hours of going around in circles this is the
only solution that consistently worked.  About 90% of the time that I
have a form that does not release is because I have an object reference
to it that I have not released.

Don't base any of your standard methodology based on what
happens after an error.  In my development environment I
have a routine that I run after any error.  This ensures that
any subsequent problems are not the result of a previous error.

-myron kirby-

===========================

Quote:

>--
>Brett Slattery

>Myron,
>Do you use this routine (cycling through and releasing each object) to
>release all your forms?

>I also have experienced a lot of problems with forms not releasing.
>Especially after an error occurs. I have to go to the command window and
>type CLEAR ALL for the form to go away. When I LIST MEMO, the only object I
>see is the name of my FORM shown as a WINDOW object. I try RELEASE WINDOW
>MYWINDOW, etc. and nothing seems to work. I want something more bulletproof
>for my distributed products. So inserting a standard routine to cycle
>through all objects looks pretty good right now if it's reliable.

>Is this what you would recommend?



>>  I finally placed a routine in the release that cycled  through all the
>contained objects and released them individually.  This has been working
>without incident for over two months.  Unfortunately I can only offer at a
>possible  work-around without providing the why's.



Sun, 12 Nov 2000 03:00:00 GMT  
 form.Release not releasing

I'm sure we're using pemstatus() somewhere in there -- the delete code
doesn't create a reference (afiak - I didn't write all of it).
If that's the case, is there anything other than clear all that will clear
the obj refs?
--
Trey Walpole

-- For legit e-mail, remove underscores



Quote:
> Trey,

> Are you using pemstatus() and/or getpem() these two functions can under
some conditions
> leave internal object references{*filter*} which will prevent an object

from destructing. If
Quote:
> not then you have to find out what is going on the  delete code that is
creating a
> reference to the object.



Sun, 12 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Trey,

If it's pemstatus() that's doing it, and I've had it happen to me, switch to using
type( "object.property" ) != "U" ) if all you are doing is checking for existence of a
property. If you need a way around other pemstatus() calls post a code fragment here I'm
sure we can find a way around it.

df    - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/

Quote:

>I'm sure we're using pemstatus() somewhere in there -- the delete code
>doesn't create a reference (afiak - I didn't write all of it).
>If that's the case, is there anything other than clear all that will clear
>the obj refs?



Sun, 12 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Myron,

Sorry to be so dense, but could you give me an example of an "object
reference" that is preventing a form's release. Where would this object
show up ("LIST MEMO", "AMEMBERS()", etc.) so that I could systematically
release/clear each objects to find the offending object?

Thank You.

--
Brett Slattery



About 90% of the time that I

Quote:
> have a form that does not release is because I have an object reference
> to it that I have not released.



Mon, 13 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Brett,

All objects have an internal reference counter. An object won't destruct until that
reference counter goes to 0.
Say you have a custom form property oFirstControl in the Init:

this.oFirstControl = this.txtField1 && or use a method/loop to find the lowest TabIndex
control

This form won't release until the object reference is cleared with:

this.oFirstControl = .null.

which you can do in the Form.Destroy() method.

You can see the same thing from the command window, if you start a form and than do
x=_screen.activeform.PickAControlAnyControl and then click the X close button on the form
window. The form won't go away until you x=.null. in the command window.

df    - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/

Quote:

>Myron,

>Sorry to be so dense, but could you give me an example of an "object
>reference" that is preventing a form's release. Where would this object
>show up ("LIST MEMO", "AMEMBERS()", etc.) so that I could systematically
>release/clear each objects to find the offending object?



Mon, 13 Nov 2000 03:00:00 GMT  
 form.Release not releasing

DUH (me, not you) -- if the code is the problem then change the code :-)

Insanity:  - n - Attempting to obtain different results from the same
actions.
--
Trey Walpole

-- For legit e-mail, remove underscores



Quote:
> Trey,

> If it's pemstatus() that's doing it, and I've had it happen to me, switch
to using
> type( "object.property" ) != "U" ) if all you are doing is checking for
existence of a
> property. If you need a way around other pemstatus() calls post a code
fragment here I'm
> sure we can find a way around it.



Mon, 13 Nov 2000 03:00:00 GMT  
 form.Release not releasing

Dave,

Sure enough, I was able to duplicate this in the command window. I think
given this information, the "Display Objects" command, and the "Amembers()"
function, I've got enough tools to find and reset the offending object to
null.

Thanks Again.
--
Brett Slattery



Quote:
> Brett,

> All objects have an internal reference counter. An object won't destruct
until that
> reference counter goes to 0.
> Say you have a custom form property oFirstControl in the Init:

> this.oFirstControl = this.txtField1 && or use a method/loop to find the
lowest TabIndex
> control

> This form won't release until the object reference is cleared with:

> this.oFirstControl = .null.

> which you can do in the Form.Destroy() method.

> You can see the same thing from the command window, if you start a form
and than do
> x=_screen.activeform.PickAControlAnyControl and then click the X close
button on the form
> window. The form won't go away until you x=.null. in the command window.

> df    - (Microsoft FoxPro MVP)

http://www.geocities.com/ResearchTriangle/9834/

- Show quoted text -

Quote:


> >Myron,

> >Sorry to be so dense, but could you give me an example of an "object
> >reference" that is preventing a form's release. Where would this object
> >show up ("LIST MEMO", "AMEMBERS()", etc.) so that I could systematically
> >release/clear each objects to find the offending object?



Mon, 13 Nov 2000 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. RELEASE LIBRARY does not release memory

2. vfp7 form.release or release window?

3. form not releasing

4. RELEASE THISFORM vs THISFORM.Release()

5. Forms not releasing in Run-time

6. Forms not releasing themselves or their datasessions

7. THISFORM.Release() .vs. RELEASE THISFORM

8. RELEASE THISFORM vs. THISFORM.Release()

9. Forms not releasing in Run-time

10. Forms not releasing in Run-time

11. Form not releasing

12. Form not releasing whwn grid has focus

 

 
Powered by phpBB® Forum Software