Microsoft KB Archive/103860

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:13, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q103860 to Microsoft KB Archive/103860 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

PRB: Destructor for Class in a DLL Called Twice

PSS ID Number: Q103860 Article last modified on 12-23-1993


The information in this article applies to:
- Microsoft Win32 Software Development Kit (SDK) for Windows NT, version 3.1


The application has the following properties and generates an access violation at exit: - There is a C++ class in a dynamic-link library (DLL) - Objects of this class type use dynamic memory - The application was built using the SDK tools


Under the following conditions, the destructor for the class in the DLL will be called twice, and therefore the memory will be freed twice, causing the access violation.


This problem does not occur when using Visual C++ for Windows NT.


This problem can be easily demonstrated by adding a CString to the DLLTrace sample program.

Additional reference words: 3.10 KBCategory: KBSubcategory: Copyright Microsoft Corporation 1993.