The information in this article applies to:
SYMPTOMSSmart pointers object creation (using _com_ptr_t::CreateInstance() ) does not release interface pointers to local or remote servers on failure. RESOLUTIONFor local and remote servers, use the CoCreateInstance() API instead of the function, _com_ptr_t::CreateInstance(). Then use the smart pointer wrapper to call methods on the object by calling _com_ptr_t::Attach(). Once the smart pointer goes out of scope, Release() is called for the interface pointer. STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. MORE INFORMATION
For local and remote servers, call CoCreateInstance() directly, as in the following sample code:
Once you have the interface, you can use the smart pointer wrapper by calling _com_ptr_t::Attach(), as in the following sample code:
REFERENCES(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Jaganathan Thangavelu, Microsoft Corporation. Additional query words: Smart pointers
Keywords : kbCOMt kbVC500bug kbVC600fix |
Last Reviewed: January 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |