FIX: Assertion Failed Line 178 or Line 527 in ARCCORE.CPPLast reviewed: September 18, 1997Article ID: Q128113 |
1.00 1.50 1.51 | 1.00 2.00
WINDOWS | WINDOWS NTkbprg kbbuglist kbfixlist kbcode The information in this article applies to:
SYMPTOMSIf a CArchive object is used with a user-defined buffer and the buffer is destroyed before the CArchive object has been destroyed, an assertion failure might occur. The message in the output window would be similar to:
CAUSEThe CArchive destructor can be found in the <MSVC install>\MFC\SRC directory in the file ARCCORE.CPP. The function is implemented as follows:
// In 16-bit MFC:CArchive::~CArchive() { ASSERT(AfxIsValidAddress(m_lpBufStart, (UINT)(m_lpBufMax - m_lpBufStart))); // ... // ...}
// In 32-bit MFC:CArchive::~CArchive() { ASSERT(m_bDirectBuffer || m_lpBufStart != NULL); ASSERT(m_bDirectBuffer || AfxIsValidAddress(m_lpBufStart,m_lpBufMax - m_lpBufStart, IsStoring())); // ... // ...} If a user-defined buffer is used for the archive (by passing it in as the lpBuf parameter to the CArchive constructor), it should be valid to call CArchive::Close on the archive, and then destroy the buffer before destroying the CArchive object. However, the above ASSERT will be executed when the CArchive object is destroyed whether the user-supplied buffer has been destroyed or not. If the buffer is destroyed before the CArchive object is destroyed, m_lpBufStart might no longer point to a valid memory address. By default it points to the address of the user-supplied buffer.
RESOLUTION
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Visual C++ for Windows, version 1.52 and in Microsoft Visual C++, 32-bit Edition, version 2.1.
|
Additional reference words: 1.00 1.50 1.51 2.00 2.50 2.51 2.10 3.00 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |