Microsoft KB Archive/253640

= BUG: Crash When Closing Table with Dirty @...GET and READ Active =

Article ID: 253640

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q253640



SYMPTOMS
Microsoft Visual FoxPro 6.0 crashes with the following Fatal Exception error:

Fatal Exception Error: Exception code=C0000005

In Visual FoxPro versions 3.0 and 5.0, the crash is an Application Error with the following text:

The instruction at referenced memory at "0x00000000". The memory could not be "read".

-or-

VFP has generated error and will be closed by Windows. You will need to restart the program.

Visual FoxPro for Macintosh crashes with an error of Type 2.

These errors are normally encountered running legacy code from earlier versions of FoxPro after editing data in an @...GET field and ending the data entry session.



CAUSE
This crash is caused by closing the table that the @...GETS are using before closing the window that the @...GETS are in.



RESOLUTION
In the code shown below, the "RELEASE WINDOW ctest" line of code should be moved so that it appears before the "CLOSE DATABASES" line of code to prevent the crash. Release the window the @...GETS are in before closing the table. The Endit procedure in the sample code in "More Information" section can be modified to prevent the crash.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
The code in the following steps creates a new table and then defines a window with two @...GETS. The END key is set up to run a procedure that closes the table and then releases the window. This causes Microsoft Visual FoxPro to crash. This same code runs fine in FoxPro for Windows or FoxPro for MS-DOS.   Create a new program file using the following code: CLEAR CLEAR ALL ON KEY LABEL end DO endit SET SAFETY OFF

CREATE TABLE crashtest (f1 c(10), f2 c(10)) USE crashtest APPEND BLANK APPEND BLANK

DEFINE WINDOW ctest FROM 5,10 TO 25,25 ACTIVATE WINDOW ctest @ 1,1 GET crashtest.f1 @ 2,1 GET crashtest.f2 READ ON KEY LABEL end

PROCEDURE endit CLOSE DATABASES RELEASE WINDOW ctest

 Save and run the program. Type some data into one of the @...GET fields and then press the END key. Visual FoxPro should crash. Try repeating the steps above except do not type anything into the @...GET fields before pressing END. Visual FoxPro should not crash. Modify the Endit procedure by placing the RELEASE WINDOW ctest line before the CLOSE DATABASES line. Save and rerun the program, repeating the steps above, and note that Visual FoxPro does not crash.</li></ol>

Keywords: kbbug kbxbase kbpending KB253640

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.