Microsoft KB Archive/221669

= FIX: Return of COM Server Objref Causes Server to Not Release =

Article ID: 221669

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q221669



SYMPTOMS
You have an application that instantiates a COM server object and stores a reference to it in a variable. The COM object instantiates a second COM server object and returns an object reference to it. Even if the variable containing the reference to the first COM server is released, the first COM server remains in memory until the second COM server is released.



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

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
 Make sure that no instances of Excel are running, and only a single instance of Visual FoxPro is running.  Run the following code from a program (.PRG) file: CLEAR ALL LOCAL oVFP, oExcel oVFP=CREATEOBJECT("visualfoxpro.application")
 * 1) DEFINE CR_LF CHR(13)+CHR(10)
 * Create VFP as a COM server

oExcel = oVFP.EVAL("createobject('excel.application')") ?oExcel.NAME       && Returns Excel
 * Tell the server to create Excel as COM server, and return it

=MESSAGEBOX('Check the task manager or task list.'+ CR_LF + CR_LF + ;  'You will see 2 instances of VFP and 1 of Excel.'+ CR_LF + ;   'Press OK to proceed.',16, 'MessageBox 1')

oVFP = NULL =MESSAGEBOX('Check the task manager or task list.'+ CR_LF + CR_LF + ;  'You will STILL see 2 instances of VFP and 1 of Excel.'+ CR_LF + ;   'Press OK to proceed.', 16, 'MessageBox 2')
 * Release VFP server reference

CLEAR ALL  When MessageBox 1 is displayed, look at the list of running programs in the Windows NT Task Manager or the Windows 9x task list. You will see two instances of Visual FoxPro and one instance of Excel. This is as expected. Click OK in MessageBox 1. When MessageBox 2 is displayed, again look at the list of running programs in the Windows NT Task Manager or the Windows 9x task list. You will still see two instances of Visual FoxPro and one instance of Excel. One of the instances of Visual FoxPro should have been released.
 * The following releases all servers OK

Keywords: kbbug kbfix kbvs600sp3fix KB221669

-

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

© Microsoft Corporation. All rights reserved.