Print Page | Close Window

Race condition crash in DockingPane Manager

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=23456
Printed Date: 19 September 2018 at 9:22pm


Topic: Race condition crash in DockingPane Manager
Posted By: adrien
Subject: Race condition crash in DockingPane Manager
Date Posted: 03 October 2017 at 7:34pm
Hi

I'm seeing a crash report in codejock in some (rare) cases when trying to install docking panes.

It happens in RecalcFramesLayout where it calls GetPaneStack().  GetPaneStack() references m_pLayout, which at this point is NULL (as the call to CreateLayout() inside  InstallDockingPanes hasn't returned yet).

This is in the same call-stack as InstallDockingPanes, where it's assigning the result of CreateLayout() to m_pLayout, so the call to CreateLayout is going up to RecalcFramesLayout before it returned and assigned m_pLayout, then GetPaneStack doesn't check if m_pLayout is NULL before dereferencing it.

here's the call stack from our loaded minidump.  Sorry, this forum doesn't seem to support code snippet markup :( (can insert movie but not code????)


  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneManager::RecalcFramesLayout() Line 1362 C++
  mfc140u.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2300 C++
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneManager::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 1598 C++
  mfc140u.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2078 C++
  mfc140u.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
  mfc140u.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam, int bDeep, int bOnlyPerm) Line 3004 C++
  mfc140u.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam, int bDeep, int bOnlyPerm) Line 2992 C++
  mfc140u.dll!CWnd::SendMessageToDescendants(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam, int bDeep, int bOnlyPerm) Line 2992 C++
  mfc140u.dll!CWnd::OnDisplayChange(unsigned int nImageDepth, int cxScreen, int cyScreen) Line 3630 C++
  mfc140u.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2300 C++
  ToolkitPro1801vc140x64U.dll!CXTPCommandBarsSiteBase<CFrameWnd>::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 202 C++
  mfc140u.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2078 C++
  mfc140u.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
  mfc140u.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 417 C++
  mfc140u.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 299 C++
  user32.dll!UserCallWinProcCheckWow() Unknown
  user32.dll!CallWindowProcW() Unknown
  ToolkitPro1801vc140x64U.dll!CXTPHookManager::HookWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 433 C++
  user32.dll!UserCallWinProcCheckWow() Unknown
  user32.dll!DispatchClientMessage() Unknown
  user32.dll!__fnINSTRINGNULL() Unknown
  ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
  win32u.dll!NtUserPeekMessage() Unknown
  user32.dll!PeekMessageW() Unknown
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneManager::RecalcFrameLayout(CXTPDockingPaneBase * pPane, int bDelay) Line 1494 C++
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneSplitterContainer::_InsertPane(CXTPDockingPaneBase * pPane, CXTPDockingPaneBase * pNeighbour, int bAfter) Line 476 C++
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneSplitterContainer::Init(CXTPDockingPaneBase * pPane, int bHoriz, CWnd * pFrame) Line 386 C++
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneLayout::CXTPDockingPaneLayout(CXTPDockingPaneManager * pManager) Line 72 C++
  ToolkitPro1801vc140x64U.dll!CXTPDockingPaneManager::CreateLayout() Line 1181 C++
> ToolkitPro1801vc140x64U.dll!CXTPDockingPaneManager::InstallDockingPanes(CWnd * pSite, bool bClipChildren) Line 883 C++
  Standard.dll!NavContainer::OnCreate(tagCREATESTRUCTW * lpCreateStruct) Line 545 C++
  mfc140u.dll!CWnd::OnWndMsg(unsigned int message, unsigned __int64 wParam, __int64 lParam, __int64 * pResult) Line 2271 C++
  mfc140u.dll!CWnd::WindowProc(unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 2078 C++
  mfc140u.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 265 C++
  mfc140u.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 417 C++
  mfc140u.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 299 C++
  user32.dll!UserCallWinProcCheckWow() Unknown
  user32.dll!DispatchClientMessage() Unknown
  user32.dll!__fnINLPCREATESTRUCT() Unknown
  ntdll.dll!KiUserCallbackDispatcherContinue() Unknown
  win32u.dll!NtUserCreateWindowEx() Unknown
  user32.dll!VerNtUserCreateWindowEx() Unknown
  user32.dll!CreateWindowInternal() Unknown
  user32.dll!CreateWindowExW() Unknown
  mfc140u.dll!IsolationAwareCreateWindowExW(unsigned long dwExStyle, const wchar_t * lpClassName, const wchar_t * lpWindowName, unsigned long dwStyle, int X, int Y, int nWidth, int nHeight, HWND__ * hWndParent, HMENU__ * hMenu, HINSTANCE__ * hInstance, void * lpParam) Line 454 C++
  mfc140u.dll!CWnd::CreateEx(unsigned long dwExStyle, const wchar_t * lpszClassName, const wchar_t * lpszWindowName, unsigned long dwStyle, int x, int y, int nWidth, int nHeight, HWND__ * hWndParent, HMENU__ * nIDorHMenu, void * lpParam) Line 724 C++
  mfc140u.dll!CWnd::Create(const wchar_t * lpszClassName, const wchar_t * lpszWindowName, unsigned long dwStyle, const tagRECT & rect, CWnd * pParentWnd, unsigned int nID, CCreateContext * pContext) Line 790 C++
  Standard.dll!SPI::GUICreateInterface(HWND__ * hParent) Line 22 C++
  GateKeeper.exe!CGateKeeperApp::CreateInterface() Line 1165 C++
  GateKeeper.exe!CGateKeeperApp::OnUpdate(unsigned __int64 wParam, __int64 lParam) Line 1008 C++
  mfc140u.dll!CWinThread::DispatchThreadMessageEx(tagMSG * pMsg) Line 771 C++
  mfc140u.dll!AfxInternalPreTranslateMessage(tagMSG * pMsg) Line 227 C++
  mfc140u.dll!AfxInternalPumpMessage() Line 178 C++
  mfc140u.dll!CWinThread::Run() Line 629 C++
  mfc140u.dll!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 47 C++
  GateKeeper.exe!__scrt_common_main_seh() Line 253 C++
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown




-------------
http://www.wingate.com - http://www.wingate.com



Replies:
Posted By: adrien
Date Posted: 03 October 2017 at 7:48pm
so it looks like the problem may be where in CXTPDockingPaneManager::RecalcFrameLayout it calls PeekMessage but doesn't expect there to be any message there except maybe WM_SIZE.

The message being processed in the call to RecalcFramesLayout is 0x0000001A (WM_WININICHANGE ????)

So maybe the user set screen magnification or something while they were setting this up.

I don't like the PeekMessage to remove a WM_SIZE then re-injecting it with PostMessage.  PeekMessage dispatches all messages prior to a matching one.


-------------
http://www.wingate.com - http://www.wingate.com


Posted By: adrien
Date Posted: 17 December 2017 at 6:48pm
actually we are getting quite a few crash dumps from a number of customers with this problem.  I don't know if it's always the same message or not.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: adrien
Date Posted: 11 January 2018 at 8:48pm
Any updates or response for this?  We're getting several crashdumps reported per day about this.  I'd rather not have to patch the toolkit myself.

-------------
http://www.wingate.com - http://www.wingate.com



Print Page | Close Window