DOCUMENT:Q299836  29-AUG-2001  [foxpro]
TITLE   :FIX: Destroy() Does Not Fire for LOCAL And PRIVATE Objects
PRODUCT :Microsoft FoxPro
PROD/VER::6.0
OPER/SYS:
KEYWORDS:kbOOP kbvfp kbvfp600 kbvfp600bug kbGrpDSFox kbCodeSnippet kbvfp700fix kbvfp700

======================================================================
-------------------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Visual FoxPro for Windows, version 6.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

If you use a local variable for an object, the Destroy event is not called when
you quit Visual FoxPro before releasing the object.

STATUS
======

This problem was corrected in Visual FoxPro version 7.0 for Windows.

MORE INFORMATION
================

Steps to Reproduce Behavior
---------------------------

1. Save the following code as a program:

   *!* Q299836 FIX: Destroy() Doesn't Fire For LOCAL And PRIVATE Objects When QUIT Is Called

   LOCAL ox 

   ox = CreateObject("TestClass")
   QUIT

   DEFINE CLASS TestClass AS Label
    PROCEDURE Destroy
     WAIT WINDOW "Destroy Event"
    ENDPROC
   ENDDEFINE

2. Run the program. Note that Visual FoxPro exits without the WAIT WINDOW
   appearing.

3. Replace the following line

   LOCAL ox

with:

   PUBLIC ox.

4. Run the program again. Note that you see a WAIT WINDOW before Visual FoxPro
   exits.

Additional query words:

======================================================================
Keywords          : kbOOP kbvfp kbvfp600 kbvfp600bug kbGrpDSFox kbCodeSnippet kbvfp700fix kbvfp700 
Technology        : kbVFPsearch kbAudDeveloper kbVFP600
Version           : :6.0
Issue type        : kbbug
Solution Type     : kbfix

=============================================================================

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 2001.