Re: VFP 8.0 losing memory variables by Mark
Mark
Fri Jan 12 10:54:21 CST 2007
Carsten Bonde wrote:
> Mark,
>
> another idea.
> Do you have a "PRIVATE ALL" statement somewhere in you code? The statement
> hides all variables.
>
> Try this, to see what i mean:
>
> TEST.PRG
> PUBLIC pScreen AS String
> pScreen= "Hello"
> ? type("pScreen")
> Foo()
>
> PROCEDURE Foo
> PRIVATE ALL
> ? type("pScreen")
> ENDPROC
>
> --
> Cheers
> Carsten
> _______________________________
>
> "Mark" <mminnie@minniebyte.com> schrieb im Newsbeitrag
> news:1168544886.795187.144460@i39g2000hsf.googlegroups.com...
> >I have a very large application that seems to be losing a public object
> > variable at run-time. I create define a public variable "pScreen",
> > initialize the variable with a blank string and then issue a command
> > such to create a form linking the variable to the screen. Such as:
> >
> > PUBLIC pScreen
> > pScreen = ""
> > DO FORM SomeScreen NAME pScreen LINKED NOSHOW
> > ......
> >
> > Somewhere in the code the variable is undefined (ie. TYPE("pScreen")=
> > "U"). I know this because when a code tries to reference the pScreen
> > variable, an exception is thrown. To debug, I set a breakpoint
> > immediately after the "DO FORM" and put TYPE("pScreen") into the watch
> > window. I set a breakpoint on the watch for when TYPE("pScreen")
> > changes. Without any other program code changes, the application runs
> > fine and the variable never becomes undefined (until I want it to be
> > undefined)!!! I follow the exact same keystrokes/mouse clicks when
> > running in debug mode with the watch as without.
> >
> > Any ideas of why the variable becomes undefined somewhere in the code
> > but not when a watch/breakpoint is set?
> >
I DO NOT have a PRIVATE ALL statement in any of my code. I do have
some CLEAR ALL and RELEASE ALL statements, but these are NOT being
executed between the time the pScreen is created and when I get my
error for pScreen being undefined. I have check for all references to
pScreen and nowhere is it released prematurely.
I have run and re-run the program with and without a breakpoint. Each
time I used the same exact mouse clicks and keystrokes. The time this
error comes up (pScreen is undefined) is when I DO NOT set a breakpoint
to check the value of pScreen. When I do set a breakpoint, pScreen
stays defined. This is FRUSTRATING!