Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Crash during application shutdown Collapse All
Subject Author Date
John Ritzenthaler Mar 5, 2009 - 5:36 PM

I’m sure I’m doing something wrong.  I hope you can give me a clue as to what it might be.


My appilcation open and closes some windows whose parent is the the desktop window.  These windows are destoryed before the main view is destroyed.


During the application shutdown I get an ASSERT at this point on the stack:


   RView.exe!CObject::IsKindOf(const CRuntimeClass * pClass=0x0172010c)  Line 45 + 0x8 bytes C++ > RView.exe!CFrameWnd::GetActiveView()  Line 1237 + 0x1f bytes C++   RView.exe!CExtControlBar::FindPrintPreviewMode(CFrameWnd * pFrame=0x02e09220)  Line 20885 + 0x8 bytes C++   RView.exe!CExtControlBar::IsOleIpObjActive(CFrameWnd * pFrameSearch=0x02e09220)  Line 11565 + 0x9 bytes C++   RView.exe!CExtNcFrameImpl::NcFrameImpl_IsSupported()  Line 1236 + 0xf bytes C++   RView.exe!CExtNCW<CFrameWnd>::WindowProc(unsigned int message=130, unsigned int wParam=0, long lParam=0)  Line 322 + 0x19 bytes C++   RView.exe!AfxCallWndProc(CWnd * pWnd=0x02e09220, HWND__ * hWnd=0x00da0944, unsigned int nMsg=130, unsigned int wParam=0, long lParam=0)  Line 240 + 0x1c bytes C++   RView.exe!AfxWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMsg=130, unsigned int wParam=0, long lParam=0)  Line 403 C++   user32.dll!75dc1a10()     [Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]    user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc2d6e()     user32.dll!75da9924()     RView.exe!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=130, unsigned int & wParam=0, long & lParam=0)  Line 217 + 0x20 bytes C++   RView.exe!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMessage=130, unsigned int wParam=0, long lParam=0)  Line 281 + 0x14 bytes C++   user32.dll!75dc1a10()     user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc1c03()     user32.dll!75dc2d6e()     user32.dll!75da9924()     RView.exe!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=16, unsigned int & wParam=0, long & lParam=0)  Line 217 + 0x20 bytes C++   RView.exe!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMessage=16, unsigned int wParam=0, long lParam=0)  Line 281 + 0x14 bytes C++   user32.dll!75dc1a10()     user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc1c03()     user32.dll!75dc2d6e()     user32.dll!75da9924()     RView.exe!CWnd::DefWindowProcA(unsigned int nMsg=274, unsigned int wParam=61536, long lParam=0)  Line 1043 + 0x20 bytes C++   RView.exe!CWnd::Default()  Line 274 C++   RView.exe!CWnd::OnSysCommand(unsigned int __formal=61536, unsigned int __formal=61536)  Line 470 + 0x11 bytes C++   RView.exe!CFrameWnd::OnSysCommand(unsigned int nID=61536, long lParam=0)  Line 1103 C++   RView.exe!CWnd::OnWndMsg(unsigned int message=274, unsigned int wParam=61536, long lParam=0, long * pResult=0x0012e308)  Line 2070 C++   RView.exe!CWnd::WindowProc(unsigned int message=274, unsigned int wParam=61536, long lParam=0)  Line 1755 + 0x20 bytes C++   RView.exe!CExtNCW<CFrameWnd>::WindowProc(unsigned int message=274, unsigned int wParam=61536, long lParam=0)  Line 326 + 0x14 bytes C++   RView.exe!AfxCallWndProc(CWnd * pWnd=0x02e09220, HWND__ * hWnd=0x00da0944, unsigned int nMsg=274, unsigned int wParam=61536, long lParam=0)  Line 240 + 0x1c bytes C++   RView.exe!AfxWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMsg=274, unsigned int wParam=61536, long lParam=0)  Line 403 C++   user32.dll!75dc1a10()     user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc2d6e()     user32.dll!75da9924()     RView.exe!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=274, unsigned int & wParam=61536, long & lParam=0)  Line 217 + 0x20 bytes C++   RView.exe!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMessage=274, unsigned int wParam=61536, long lParam=0)  Line 281 + 0x14 bytes C++   user32.dll!75dc1a10()     user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc1c03()     user32.dll!75dc5b49()     user32.dll!75dc3656()     ntdll.dll!76ec0e6e()     user32.dll!75dc2335()     user32.dll!75daf807()     RView.exe!CWnd::SendMessageA(unsigned int message=274, unsigned int wParam=61536, long lParam=0)  Line 42 + 0x44 bytes C++   RView.exe!CExtNcFrameImpl::NcFrameImpl_PreWindowProc(long & lResult=0, unsigned int message=514, unsigned int wParam=0, long lParam=-654427)  Line 2943 C++   RView.exe!CExtNCW<CFrameWnd>::WindowProc(unsigned int message=514, unsigned int wParam=0, long lParam=-654427)  Line 324 + 0x29 bytes C++   RView.exe!AfxCallWndProc(CWnd * pWnd=0x02e09220, HWND__ * hWnd=0x00da0944, unsigned int nMsg=514, unsigned int wParam=0, long lParam=-654427)  Line 240 + 0x1c bytes C++   RView.exe!AfxWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMsg=514, unsigned int wParam=0, long lParam=-654427)  Line 403 C++   user32.dll!75dc1a10()     user32.dll!75dc1ae8()     user32.dll!75dc1a91()     user32.dll!75dc2d6e()     user32.dll!75da9924()     RView.exe!CExtHookSink::HookChains_t::HookChainsWindowProc(unsigned int nMessage=514, unsigned int & wParam=0, long & lParam=-654427)  Line 217 + 0x20 bytes C++   RView.exe!CExtHookSink::HookChains_t::g_HookWndProc(HWND__ * hWnd=0x00da0944, unsigned int nMessage=514, unsigned int wParam=0, long lParam=-654427)  Line 281 + 0x14 bytes C++


It appears to me that the main window is being destroyed at this point.  message 274 is WM_SYSCOMMAND and message 130 is WM_NCDESTROY.  The assert if becasue the handle of CFrameWnd::m_pViewActive is 0xfeeefeee.  So it appears the view has been destroyed.


Any idea what I might be doing (or NOT doing)?

Technical Support Mar 9, 2009 - 11:41 AM

The active view is the term related to MFC’s document view architecture rather than to to the windowing system displayed on the desktop of the Windows OS. We suspect you created some views manually and some of them become marked as active. You can invoke frame’s CFrameWnd::SetActiveView(NULL) method at shutdown. You can set breakpoint inside this method and try to find out which views become active in your application and when.

John Ritzenthaler Mar 9, 2009 - 1:54 PM

Thanks for your help.


Your suspicion was incorrect.  I only use a single view.  It gets set at the start of execution.   That’s the only call to SetActiveView().


But your suggestion solved the problem.  It tried overriding DestroyWindow() for the view but that never gets called.  So I added this to the view desctructor:


 CFrameWnd* pFrame = (CFrameWnd*)AfxGetMainWnd();

 if (pFrame->GetActiveView() == this)   pFrame->SetActiveView(0, FALSE);


That fixed it.  The MFC framework should probably be doing this but isn’t.  I can only wondow why no one else has run into this.


Again, thanks.


 

Technical Support Mar 10, 2009 - 5:43 AM

MFC does correct disconnection of the references to active view window but only in the case of document/view architecture.