FIX: MFC Sockets Application Causes GP Fault on ExitLast reviewed: September 18, 1997Article ID: Q130653 |
1.52
WINDOWS
kbprg kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSAn MFC application that uses MFC's socket classes (CSocket and CAsyncSocket) and statically links with MFC causes a general protection (GP) fault on exit. The GP fault occurs on the following line in SOCKCORE.CPP: SOCKCORE.CPP(32): if (_afxSockState->lpfnSockCleanup != NULL)This error occurs if the application contains a call to AfxSocketInit but for some reason terminates without ever actually calling that function. It will also occur if the call to AfxSocketInit fails.
CAUSEThe MFC socket implementation maintains a static pointer to a structure that maintains socket state information. This variable is defined in SOCKCORE.CPP as:
static AFX_SOCKSTATE* _afxSockState;_afxSockState is initialized when an application calls AfxSocketInit. However if an application does not call AfxSocketInit or the call to AfxSocketInit fails, the variable is not initialized, and the 'if' statement shown above attempts to remove the reference to a NULL pointer, which causes the GP fault.
RESOLUTION
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in MFC version 2.53 included with Microsoft Visual C++ version 1.52b for Windows.
|
Additional reference words: 1.52 2.52 GPF
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |