Print Page | Close Window

Intermittent crash in frame hook

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=24063
Printed Date: 22 December 2024 at 6:23pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Intermittent crash in frame hook
Posted By: ericgen34
Subject: Intermittent crash in frame hook
Date Posted: 22 September 2020 at 5:03am
Hi, 

We keep having some intermittent crashes reported by customers that we cannot reproduce in dev. The call stack of a typical crash is shown below.

I wonder if someone has any idea what is going on? Or how we can start looking into this? We are using the framework normally as far as I know

Thank you!




Replies:
Posted By: ericgen34
Date Posted: 22 September 2020 at 5:05am
Apologies, the call stack screen shot didnt show. Here it is copied:

  KERNELBASE.dll!_RaiseException@16() Unknown
  VCRUNTIME140.dll!_CxxThrowException(void * pExceptionObject, const _s__ThrowInfo * pThrowInfo) Line 129 C++
  mfc140u.dll!AfxThrowResourceException() Line 1347 C++
> mfc140u.dll!CWindowDC::CWindowDC(CWnd * pWnd) Line 1018 C++
  ToolkitPro1900vc150U.dll!CXTPCommandBarsFrameHook::RedrawFrame() Line 627 C++
  ToolkitPro1900vc150U.dll!CXTPCommandBarsFrameHook::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned int & wParam, long & lParam, long & lResult) Line 1025 C++
  ToolkitPro1900vc150U.dll!CXTPHookManager::CHookSink::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned int & wParam, long & lParam, long & lResult) Line 319 C++
  ToolkitPro1900vc150U.dll!CXTPHookManager::HookWndProc(HWND__ * hWnd, unsigned int message, unsigned int wParam, long lParam) Line 440 C++
  user32.dll!__InternalCallWinProc@20() Unknown
  user32.dll!UserCallWinProcCheckWow() Unknown
  user32.dll!DispatchClientMessage() Unknown
  user32.dll!___fnDWORD@4() Unknown
  ntdll.dll!_KiUserCallbackDispatcher@12() Unknown
  user32.dll!RealDefWindowProcWorker() Unknown
  user32.dll!RealDefWindowProcW() Unknown
  uxtheme.dll!_ThemeDefWindowProc() Unknown
  uxtheme.dll!_ThemeDefWindowProcW@16() Unknown
  user32.dll!DefWindowProcW() Unknown
  user32.dll!DefWindowProcWorker() Unknown
  user32.dll!DefDlgProcWorker() Unknown
  user32.dll!_DefDlgProcW@16() Unknown
  user32.dll!UserCallWinProcCheckWow() Unknown



Posted By: agontarenko
Date Posted: 25 September 2020 at 2:30am
Hello,

Unfortunately it is not clear what exactly is going wrong. Can you please provide more detailed information. If it cannot be re-produced in any of our sample applications provided I would appreciate you sending a sample application so that we could debug it.

Regards,
Artem Gontarenko


Posted By: ericgen34
Date Posted: 25 September 2020 at 3:31am
Well, we cant reproduce it either, and the application is rather big, I cant really send a sample I'm afraid. I just wondered if there are specific areas to look into


Posted By: rdhd
Date Posted: 02 October 2020 at 5:47pm
It would appear the input window to the constructor is not a valid window during the entire call to the constructor. Are you threading? MFC isn't thread safe.

A lot can go on while this code executes:

    ASSERT(pWnd == NULL || ::IsWindow(pWnd->m_hWnd));

    if (!Attach(::GetWindowDC(m_hWnd = pWnd->GetSafeHwnd())))

The first line is only executed for debug builds. If you want to validate a window during release builds, you have to make the IsWindow call before calling the constructor. If a thread takes over while doing "m_hWnd = ...) no the m_hWnd could be bad before the call to Attach is made.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net