Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/103860

From BetaArchive Wiki

PRB: Destructor for Class in a DLL Called Twice

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

3.10 WINDOWS

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

SYMPTOMS

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

CAUSE

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.

RESOLUTION

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

MORE INFORMATION

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.