Discussion:
Form session not being released when nopageeject used - VFP9
(too old to reply)
DeCiacco
2005-10-18 15:45:30 UTC
Permalink
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....

This is the Init() event of FormB:

LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF

.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3

SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF

THISFORM.DisplayPage()
ENDWITH

When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.

Does anyone have any idea why Unknown would not get released if nopageeject is used?

Thanks.
Jack Jackson
2005-10-18 17:26:28 UTC
Permalink
On Tue, 18 Oct 2005 10:45:30 -0500, DeCiacco
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Are you programatically changing the data session with SET
DATASESSION? If so, are you changing it back? VFP gets confused if
you don't.

I have no idea why NOPAGEEJECT would affect closing the data session.
DeCiacco
2005-10-18 17:35:20 UTC
Permalink
No I don't programatically set the datasession. When would I do have to do this?
Post by Jack Jackson
On Tue, 18 Oct 2005 10:45:30 -0500, DeCiacco
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Are you programatically changing the data session with SET
DATASESSION? If so, are you changing it back? VFP gets confused if
you don't.
I have no idea why NOPAGEEJECT would affect closing the data session.
Jack Jackson
2005-10-19 05:53:54 UTC
Permalink
You said that FormA has a private datasession, yet FormB uses cursors
from FormA's datasession. I therefore assumed that you changed the
datasession in FormB - I don't know of any other way you could see
FormA's cursors in FormB.

On Tue, 18 Oct 2005 12:35:20 -0500, DeCiacco
Post by DeCiacco
No I don't programatically set the datasession. When would I do have to do this?
Post by Jack Jackson
On Tue, 18 Oct 2005 10:45:30 -0500, DeCiacco
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Are you programatically changing the data session with SET
DATASESSION? If so, are you changing it back? VFP gets confused if
you don't.
I have no idea why NOPAGEEJECT would affect closing the data session.
Fred Taylor
2005-10-19 06:14:47 UTC
Permalink
Using the default session in FormB would share the datasession of whatever
called it, in this case, FormA's datasession.
--
Fred
Microsoft Visual FoxPro MVP
Post by Jack Jackson
You said that FormA has a private datasession, yet FormB uses cursors
from FormA's datasession. I therefore assumed that you changed the
datasession in FormB - I don't know of any other way you could see
FormA's cursors in FormB.
On Tue, 18 Oct 2005 12:35:20 -0500, DeCiacco
Post by DeCiacco
No I don't programatically set the datasession. When would I do have to do this?
Post by Jack Jackson
On Tue, 18 Oct 2005 10:45:30 -0500, DeCiacco
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Are you programatically changing the data session with SET
DATASESSION? If so, are you changing it back? VFP gets confused if
you don't.
I have no idea why NOPAGEEJECT would affect closing the data session.
DeCiacco
2005-10-18 18:50:25 UTC
Permalink
Update!

Its not the nopageeject thats causing the datasession to stay alive, but the use of
two consecutive REPORT FORM statements. In other words...If I remove the second
REPORT FORM <frxname> OBJECT <objectname> then the session release w/o problems. That
second REPORT FORM statement is doing something to keep the session in memory.
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Thanks.
DeCiacco
2005-10-18 20:24:00 UTC
Permalink
Update!
Clear All is the only thing that works in releasing the datasession.
I've tried all other release commands and clear commands. When that second REPORT
FORM fires some reference to the Listener object gets created in the datasession that
does not get released.

I'm beginning to think this is a bug.
Post by DeCiacco
I have two top level forms, FormA and FormB. FormA gets the data in the proper
cursors and then calls FormB to display a preview of the report which uses the
cursors opened by FormA. FormA uses a private datasession and FormB uses the default
datasession. When FormB comes up it "shares" FormA's datasession. FormB has the
necessary components to display the preview and it works great, however....
LOCAL numofrecs as Integer
WITH THISFORM
IF VARTYPE(.oListener) = 'O'
.oListener.ONPREVIEWCLOSE()
ENDIF
.oListener = CREATEOBJECT("ReportListener")
.oListener.LISTENERTYPE = 3
SELECT curzipdistrib
COUNT TO numofrecs
IF numofrecs > 0 THEN
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER nopageeject
SELECT curzipdistrib
REPORT FORM zipdistrib.frx OBJECT .oLISTENER
ELSE
SELECT curcensusmain
REPORT FORM distribution.frx OBJECT .oLISTENER
ENDIF
THISFORM.DisplayPage()
ENDWITH
When I close FormB the Datasession names turns to Unknown(2). This is by design. When
I close FormA the Unknown(2) session should also close. I know this because I created
a test app and it ended works. The session is not be released because there is
something still referencing it. What I've discovered is that if I don't use the
NOPAGEEJECT as shown above, but just display my first report, then Unknown(2) closes
fine when I close FormA. So I know that it has something to do with NOPAGEEJECT. I'm
not sure what it is. I thought it was the CommandClauses object that gets created in
the report listener not being properly destroyed, but I tried to explicitly set it to
.NULL. right before setting my ReportListener object to .NULL., but that did nothing.
It is my understanding that by setting the reference to the object to .NULL. the
object gets destroyed, although it doesn't make sense. At the same time there is no
other way to destroy an object who's reference is a property in a form. In other
words, I can't do RELEASE thisform.oListener.
Does anyone have any idea why Unknown would not get released if nopageeject is used?
Thanks.
Loading...