Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form's datasession can't be released
Message
De
01/04/2002 11:21:43
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00605724
Message ID:
00639473
Vues:
26
Hi Nadya,

Yes... your probable solution seems clear and simple. But I've a reasonable doubt about if it will works. Explaining: In my case, even releasing the caller form and its DS (a private one) the 2nd "unknown" DS still remains, if using type() function. But we have to try to be sure.

Fábio

>Hi Fabio,
>
>I'm not sure, what in our case it's the type function to blame. My colleague changed every occurrence of type() function to vartype() function, but the problem still remained. This application is extremely complicated, so it's hard to trace the problem, besides, it's not mine, so I offered some help, but I can not spend too much time on it.
>
>I also have an idea, which may simplify this application. Currently it has Update library with couple of classes, one of them is update class based on custom class. In the init of this class it opens a form and all operations are happening in the form's private DS. So, I'm thinking, why do we need to complicate our life. Just made this form to be an update class, make this form a class, that's it. Simple, right? And I hope, it would solve this Unknown session problem as well.
>
>Still it would be interesting to find the root of the problem...
>
>>Hi Nadya!
>>
>>Well... Probably we are facing a bug (some kind of memory leak) when using the type() function.
>>I've noticed this happens when frx2word starts. I've tried isolating the problem interrupting the class execution in several points. This type() function was used in the beginning of the reportform method as follows:
>>
>>
>>dimension apropchar(5,2)
>>oword = createobject("word.application")
>>with oword
>>    apropchar(1,1) = ".Application.UserName"
>>    apropchar(2,1) = ".Application.UserInitials"
>>    apropchar(3,1) = ".Application.UserAddress"
>>    apropchar(4,1) = ".Activedocument.Password"
>>    apropchar(5,1) = ".Activedocument.WritePassword"
>>    for i = 1 to 5
>>        if  type(apropchar(m.i,1)) # "U"
>>            apropchar(m.i,2) = evaluate(apropchar(m.i,1))
>>        endif
>>    next
>>endwith
>>
>>Even using all kind of CLEAR statements, the unknown datasession still remains. And yes... CLEAR ALL manage to kill the unknown datasession, but it clears everything and it is not desirable.
>>When I've found this error, I simply comment the IF statement and the second datasession vanish as desired.
>>I've tried reproducing this error in a single form, but it'll not occur. It seems only occurs when the type function is contained in a class.
>>I suggest you the same approach, i.e., trying interrupting your class in order to see where it happens.
>>
>>Let me know the results.
>>
>>Fábio
>>
>>>Hi Fabio,
>>>
>>>We seemed to just be hit by the similar problem. My colleague inherited an application from another colleague. This application uses lots of constructs like if type('oValid')<>"O" ...
>>>She closed everything in Destroy method, yet we see "Unknown datasession 2", which is empty. We tried to execute every clear command, e.g.:
>>>CLEAR CLASSLIB name
>>>CLEAR TYPEHEAD
>>>etc. and it was not released until we typed clear all.
>>>
>>>I just showed her this message from you, so she is working on the code right now and making changes. Let's see, if it would solve this problem, and if it would, it clearly looks like a bug and should be reported...
>>>
>>>UPDATE
>>>Well, changing type to vartype didn't help in her case. Basically, the application looks like:
>>>
>>>main program
>>>public oUpdate
>>>oUpdate = createobject('Update')
>>>...
>>>
>>>Update.Init:
>>>
>>>do some stuff
>>>do form myFormWithPrivateDS
>>>do some other stuff, which use Form's DS as a parameter
>>>
>>>Since it's not my application, I'm not familiar with the logic and inner details, anyway, can anybody see, why form's datasession could be left opened?
>>>
>>>I offered her some help (e.g. dig into the code and try to fix this problem myself), but she refused so far...
>>>
>>>
>>>>No prob.
>>>>
>>>>The code is:
>>>>
>>>>
>>>>dimension apropchar(5,2)
>>>>oword = createobject("word.application")
>>>>with oword
>>>>    apropchar(1,1) = ".Application.UserName"
>>>>    apropchar(2,1) = ".Application.UserInitials"
>>>>    apropchar(3,1) = ".Application.UserAddress"
>>>>    apropchar(4,1) = ".Activedocument.Password"
>>>>    apropchar(5,1) = ".Activedocument.WritePassword"
>>>>    for i = 1 to 5
>>>>        if  type(apropchar(m.i,1)) # "U"
>>>>            apropchar(m.i,2) = evaluate(apropchar(m.i,1))
>>>>        endif
>>>>    next
>>>>endwith
>>>>
>>>>The code is fine and everything works, Claudio. But it isn't the point. I just try to say about a Type() function wich causes a memory hole or something. The objective of this code is to determine some Word properties and hold them. The property oword.activedocument.password if not set, will become undefined. Removing the password property test, the problem with datasession will not occurs.
>>>>
>>>>Btw, there is NO runtime errors.
>>>>
>>>>Thanks for your attention.
>>>>
>>>>Fábio
>>>>
>>>>>Fabio
>>>>>
>>>>>>
>>>>>>
apropchar(1,1) = ".Application.UserName"
>>>>>>apropchar(?,1) = "...
>>>>>>
>>>>>>for i = 1 to ?
>>>>>>    if  type(aWordpropchar(m.i,1)) # "U"
>>>>>>...
>>>>>>
>>>>>
>>>>>If we analyze just that piece that you publ. here there is a dot at the first line (before appication) that looks weird for me.
>>>>>
>>>>>Like the first code that you publ. hardly had anything in common with this here.
>>>>>
>>>>>Can you publ. the whole code ?
>>>>>
>>>>>
>>>>>Claudio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform