Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TIP - Invalid Page Faults
Message
From
27/08/1999 21:25:47
 
 
To
27/08/1999 12:06:50
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00258020
Message ID:
00258729
Views:
10
Sorry, I gave you a typo (wrong ClassLib) - it should be this:

Now from the Command Window, type:

oCrash = NEWOBJECT("cusgfp", "c:\program files\microsoft visual studio\vfp98\testgfp.vcx")
RELEASE oCrash
oCrash = NEWOBJECT("cusgfp", "c:\program files\microsoft visual studio\vfp98\testgfp.vcx")


>Dave,
>
>Create the following class:
>
>*-- Class: cusgfp (c:\program files\microsoft visual studio\vfp98\testgfp.vcx)
>*-- ParentClass: custom
>*-- BaseClass: custom
>*-- Time Stamp: 08/27/99 08:47:11 AM
>
>
>DEFINE CLASS cusgfp AS custom
>
>	cSetClassLib = ""
>	Name = "cusgfp"
>
>	PROCEDURE Init
>		This.cSetClassLib = SET("CLASSLIB")
>		SET CLASSLIB TO
>	ENDPROC
>
>	PROCEDURE Destroy
>		LOCAL lcSetClassLib
>
>		lcSetClassLib = This.cSetClassLib
>		SET CLASSLIB TO &lcSetClassLib
>	ENDPROC
>
>ENDDEFINE
>
>
>Now from the Command Window, type:
>
>oCrash = NEWOBJECT("cusgfp", "c:\program files\microsoft visual studio\vfp98")
>RELEASE oCrash
>oCrash = NEWOBJECT("cusgfp", "c:\program files\microsoft visual studio\vfp98")
>
>BLAMO
>
>The Invalid Page Fault occurs when you instantiate the object the second time. This makes sense due to my understanding of an implicit SET CLASSLIB when using NEWOBJECT for object instantiation.
>
>While one may say that someone would be insane to use a class like the one above, some objects instantiate other objects which instantiate other... and so on. I found this problem with my framework's application object which fires an environment object used to set/reset global SETS - including SET CLASSLIB.
>
>
>
>>Please provide a code sample. Your steps below are confusing to me.
>>
>>Thanks,
>>
>>Dave
>>
>>>I have found a special case that is guaranteed to cause a VFP Invalid Page Fault and, therefore, should be avoided:
>>>
>>>- NEWOBJECT(CLassName, CLassLibrary) is used to instantiate an object and ;
>>>
>>>- SET CLASSLIB TO is issued before the instantiation of the object is complete and ;
>>>
>>>- SET CLASSLIB TO ClassLibrary (same class library) is issued after the instantiation of the object is complete and ;
>>>
>>>- The object is released and ;
>>>
>>>- NEWOBJECT(CLassName, CLassLibrary) is used to instantiate the object again, THEN ;
>>>
>>>blamo - VFP Invalid Page Fault every time.
- Jeff
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform