DOCUMENT:Q253640 16-FEB-2000 [foxpro] TITLE :BUG: Crash When Closing Table with Dirty @...GET and READ Active PRODUCT :Microsoft FoxPro PROD/VER:MACINTOSH:3.0b; WINDOWS:3.0b,5.0,5.0a,6.0 OPER/SYS: KEYWORDS:kbvfp300b kbvfp300bBUG kbvfp500 kbvfp500a kbvfp500aBUG kbvfp600 kbvfp600bug kbXBase kbV ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 3.0b, 5.0, 5.0a, 6.0 - Microsoft Visual FoxPro for Macintosh, version 3.0b ------------------------------------------------------------------------------- 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 this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATION ================ 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. 1. 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 2. Save and run the program. 3. Type some data into one of the @...GET fields and then press the END key. Visual FoxPro should crash. 4. Try repeating the steps above except do not type anything into the @...GET fields before pressing END. Visual FoxPro should not crash. 5. 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. Additional query words: ====================================================================== Keywords : kbvfp300b kbvfp300bBUG kbvfp500 kbvfp500a kbvfp500aBUG kbvfp600 kbvfp600bug kbXBase kbVS600sp3 kbGrpDSFox kbDSupport Technology : kbHWMAC kbOSMAC kbVFPsearch kbAudDeveloper kbVFP300bMac kbVFP300b kbVFP500 kbVFP600 kbVFP500a Version : MACINTOSH:3.0b; WINDOWS:3.0b,5.0,5.0a,6.0 Issue type : kbbug Solution Type : kbpending ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2000.