Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wiping out (data)Session object
Message
From
28/05/2008 05:46:56
 
 
To
27/05/2008 03:28:42
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01319497
Message ID:
01319898
Views:
28
>>>One possibility is to subclass Session, add a release method and call that - that may work - not tested
>>>
>>>
>>>define class MySession as Session
>>>
>>>function Release()
>>>  release m.this
>>>endfunc
>>>enddefine
>>>
>>
>>Great !!
>>It was already subclassed sesion object so it did the trick perfectly!
>>
>>Funny thing is that is needed only when executing frx via listener.
>>Otherwise session releases normaly (as it should), being that local var holding object reference goes out of scope.
>>
>>Thks+++ 2 everybody
>_____________
>It's the same with a form. If you hold a reference to a form, call form.Release(), your reference will be null
>
>The listener must create an object in that datasession and hold a reference to that object - I see no other explanation
>
>A similar thing happens if in a form with private datasession, you create an object and add it to _screen (or goApp). The datasession won't release since an object with that datasessionId is still alive in _screen
>
>These 'errors' are hard to find
>
>I have added a property 'datasession' to my base lightweight class, so I can find the origin of the problem more easily
>
>
>#define TRUE	.T.
>#define FALSE	.F.
>
>#define	LIGHTWEIGHT_CLASS	[_LightWeightClass_]
>
>define class LIGHTWEIGHT_CLASS as Relation
>	
>	Name			= LIGHTWEIGHT_CLASS
>	DataSessionId		= 0
>	
>
>*--------------------------------------------------------------------------
>protected function Init()
>
>	local Success
>	Success = TRUE
>	
>	do case
>	case !m.Success
>	
>	case !DoDefault()
>		assert FALSE
>		Success = FALSE
>		
>	case !m.this.AddProperty('DataSessionId', set('dataSession'))
>		assert FALSE
>		Success = FALSE
>         endcase
>
>	return m.Success
>endfunc
>*--------------------------------------------------------------------------
>function Release()
>	
>	release (m.this)
>
>endfunc
>*--------------------------------------------------------------------------
>*--------------------------------------------------------------------------
>enddefine
>
Hi Gregory,

I checked my listener, and it does not have any unreleased object references. I release implicitly everything attached (GdiPlusX refs) in AfterReport method, so presumably that reference is held somewhere in listener class/functionality itself.

In my session slass I simply did exactly as you suggested and it
works just fine!
I also keep session Id, but moreover I keep an array (on global object) holding all (twin) object refs. This tip helps in both situations
Weather session is 'registered' and held by global object, or freely instantiated and held by local var. Works like a charm now both ways :)

Thank You again :)
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Reply
Map
View

Click here to load this message in the networking platform