Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wiping out (data)Session object
Message
From
27/05/2008 03:28:42
 
 
To
26/05/2008 14:24:16
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01319497
Message ID:
01319606
Views:
13
>>>>
>>>Calling Destroy() method directly (or release method directly) works?
>>>
>>>E.g. array[i].Destroy()
>>> array[i] = null
>>>
>>>?
>>__
>>Calling Destroy() will not work, I assume.
>>
>>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
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform