There can be as many causes for a GPF as there are lines of code in a program. Some common causes include.
Generic
- Remove all generated files and do a full recompile: CLW, INC, OBJ, RSC, EXP, LIB, MAP, EXE, DLL.
- Compile with full debug information.
- Enable project options runtime checks: Index out of range and Stack overflow.
- Use CLARUNX.DLL from the debug folder.
- Use CapeSoft GPF Reporter and refer to it’s documentation.
References
- Check whether reference variables are not accessed after DISPOSE.
- NEW and DISPOSE should be balanced.
- Check if references are initialized before usage.
- When passing references, be sure that the object is available as long as it’s accessed.
- When passing omittable references, be sure to check that the parameter is not OMITTED. Perform this check in a routine and not a ABC method as it would apply to that method not the procedure itself.
- Using a reference that is NULL. Check address: IF NOT reference &= NULL THEN.
- After DISPOSE, references do not have to be reset to &= NULL.
- Use the correct: ADDRESS versus INSTANCE.
- Changing contents of parameters that can and have been omitted.
Buffer Overflow
- String Slicing that goes out of bounds, this does not create a gpf directly but messes up other variables.
API
- API calls, where the prototype is wrong. Including missing RAW or PASCAL or C attributes.
Classes
- The class has unset or wrongly set pragmas (LinkMode, DllMode) will GPF, the first time you ‘touch’ the class.
- The class has a module attribute and the include was at a non-static scope will GPF, the first time you ‘touch’ the class.
- When a class reference is NULL, static methods can still be called. Except when using properties.
Notes
-
If object is a string, then you SHOULD set it to NULL after disposing in order to set the SIZE to zero. While dispose will release the memory for the string, it will not clear the size attribute. Setting the string &= NULL will set size to zero. If you never use size(myString) then you would not care. if you pass MyString (the &STRING) to a procedure Then it will show the SIZE(xPassedString) to be 0 after the DISPOSE.
MyString &STRING CODE MyString &= NEW STRING( x ) DISPOSE( MyString ) ! SIZE(MyString) will show X IF MyString &= NULL ! is true MyString &= NULL END ! SIZE(MyString) will show 0 ! IF MyString &= NULL ! is true
Hanging application
- Pressing Alt or Alt+Space on a Frame with a menu. Apply AltWin7Fix template which might be needed on Win10 also. A hanging application can be recovered with Ctrl+Esc.
Thanks
- Geoff Robinson
- Mark Goldberg
- Eric Lankreijer