CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    3

    Crash in Release Build for NT only

    Hi All,

    Win 95, NT4.0 Visual C++ 5.0

    I have an app that has two threads running. The main thread and the socket worker thread. The app is the client in our client-server software.
    The strange thing is that when we run the release build under NT4.0 it crashes with the following error :

    Unhandled exception at Iviewer.exe (MFC42.dll):0xC0000005:Access Violation

    The breakpoint is within the following function:

    LRESULT AFXAPI AfxCallWndProc(CWnd* pWnd, HWND hWnd, UINT nMsg,
    WPARAM wParam = 0, LPARAM lParam = 0)
    {
    _AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
    MSG oldState = pThreadState->m_lastSentMsg; // save for nesting
    pThreadState->m_lastSentMsg.hwnd = hWnd;
    pThreadState->m_lastSentMsg.message = nMsg;
    pThreadState->m_lastSentMsg.wParam = wParam;
    pThreadState->m_lastSentMsg.lParam = lParam;

    #ifdef _DEBUG
    if (afxTraceFlags & traceWinMsg)
    _AfxTraceMsg(_T("WndProc"), &pThreadState->m_lastSentMsg);
    #endif

    // Catch exceptions thrown outside the scope of a callback
    // in debug builds and warn the user.
    LRESULT lResult;
    TRY
    {
    #ifndef _AFX_NO_OCC_SUPPORT
    // special case for WM_DESTROY
    if ((nMsg == WM_DESTROY) && (pWnd->m_pCtrlCont != NULL))
    pWnd->m_pCtrlCont->OnUIActivate(NULL);
    #endif

    // special case for WM_INITDIALOG
    CRect rectOld;
    DWORD dwStyle;
    if (nMsg == WM_INITDIALOG)
    _AfxPreInitDialog(pWnd, &rectOld, &dwStyle);

    // delegate to object's WindowProc
    lResult = pWnd->WindowProc(nMsg, wParam, lParam);

    // more special case for WM_INITDIALOG
    if (nMsg == WM_INITDIALOG)
    _AfxPostInitDialog(pWnd, rectOld, dwStyle);
    }
    CATCH_ALL(e)
    {
    lResult = AfxGetThread()->ProcessWndProcException(e, &pThreadState->m_lastSentMsg);
    TRACE1("Warning: Uncaught exception in WindowProc (returning %ld).\n",
    lResult);
    DELETE_EXCEPTION(e);
    }
    END_CATCH_ALL

    pThreadState->m_lastSentMsg = oldState;
    return lResult;
    }

    This is the value of oldState according to MsDev :

    oldState {msg=0x00000000 wp=0x00000000 lp=0x00000000}


    Thanks in advance!

    BTW I am currently trying to find a clue in the MSDN Library. Currently trying to understand the :

    C++ Q & A
    Paul DiLascia



    ( a search for AfxCallWndProx only produced two results)

    _________________________________________
    | Robert M. Bernabe [email protected]
    | Senior Software Engineer
    | Infinity Information Systems www.i2sys.com



  2. #2
    Join Date
    May 1999
    Location
    Netherlands
    Posts
    57

    Re: Crash in Release Build for NT only

    Did you try to set optimizations off?

    Because global variables are not updated when not set to virtual, when it is on.

    Mark



  3. #3
    Guest

    Re: Crash in Release Build for NT only

    Hi Mark,

    Thanks for the reply. Yes I did...same thing happened. I forgot to mention that the app runs fine...until you close it. The app is the client in a client-server platform. The server can instantiate multiple frame windows through a proprietary script. When I close any of the main (some windows are, this is set through script) window it should close the app. This is when the problem occurs

    RBernabe...Obet


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured