Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPCommandBarsFrameHook causing aborts
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPCommandBarsFrameHook causing aborts

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 935
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPCommandBarsFrameHook causing aborts
    Posted: 21 hours 23 minutes ago at 1:32pm
Our app is crashing in a specific workflow because CXTPCommandBarsFrameHook:RedrawRibbonBar is being called after CXTPCommandBarsFrameHook::~CXTPCommandBarsFrameHook has been called.

The workflow is as follows. We are an MDI app and we call EnableFrameTheme on the CXTPRibbonBar. The ribbon bar pointer is stored in CXTPCommandBarsFrameHook.

The user modifies a document. Then the user right clicks the app icon in the Windows App Bar and clicks the Close entry the OS shows. The user is prompted to save the file and clicks "No". The app starts to shut  down.

CXTPCommandBarsFrameHook::GetAutoHideBar gets called. SHAppBarMessage is called and that eventually leads to the CXTPCommandBarsFrameHook destructor. 

This leads to a crash, for example, in RedrawFrame because GetFramePaintManager() call returns a null pointer. 

>    ToolkitPro2410vc170x64U.dll!CXTPCommandBarsFrameHook::RedrawFrame() Line 642    C++
     ToolkitPro2410vc170x64U.dll!CXTPCommandBarsFrameHook::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 1285    C++
     ToolkitPro2410vc170x64U.dll!CXTPHookManager::CHookSink::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 322    C++
     ToolkitPro2410vc170x64U.dll!CXTPHookManager::HookWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 443    C++
     user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)    Unknown
     user32.dll!DispatchClientMessage()    Unknown
     user32.dll!__fnDWORD()    Unknown
     ntdll.dll!KiUserCallbackDispatcherContinue()    Unknown
     win32u.dll!NtUserMessageCall()    Unknown
     user32.dll!SendMessageWorker()    Unknown
     user32.dll!SendMessageW()    Unknown
     [Inline Frame] mfc140u.dll!CWnd::SendMessageW(unsigned int) Line 32    C++
     mfc140u.dll!CFrameWnd::NotifyFloatingWindows(unsigned long dwFlags) Line 570    C++
     mfc140u.dll!CFrameWnd::OnActivate(unsigned int nState, CWnd * pWndOther, int bMinimized) Line 1082    C++

In debug the crash can occur elsewhere as m_pRibbonbar is accessed in RedrawRibbonBar because it is not null (it is 0xdddddddddddddddd - debug poison pill). In that case CXTPCommandBarsFrameHook::GetAutoHideBar is still on the stack.


Fortunately, I can duplicate this with the MFC\Xtreme ToolkitPro  24.1.0\Samples\CommandBars\CommandBarsSample

Just run the sample and in the MDI window type some text. Then right click the icon in the app/task bar and choose close. Then just say No when prompted to save the file.

I am trying to build that sample using Dynamic Unicode Release but I get a build failure due to a "missing file", which of course the IDE knows the name of but as is typical of Microsoft programming the IDE is keeping the name of said file to itself. 

Here is the call stack for that sample built with static unicode release (I turned on debug info).

>    CommandBarsSample.exe!CXTPCommandBarsFrameHook::RedrawFrame() Line 642    C++
     CommandBarsSample.exe!CXTPCommandBarsFrameHook::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 1285    C++
     CommandBarsSample.exe!CXTPHookManager::CHookSink::OnHookMessage(HWND__ * hWnd, unsigned int nMessage, unsigned __int64 & wParam, __int64 & lParam, __int64 & lResult) Line 322    C++
     CommandBarsSample.exe!CXTPHookManager::HookWndProc(HWND__ * hWnd, unsigned int message, unsigned __int64 wParam, __int64 lParam) Line 443    C++
     user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned __int64,__int64),struct HWND__ *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)    Unknown
     user32.dll!DispatchClientMessage()    Unknown
     user32.dll!__fnDWORD()    Unknown
     ntdll.dll!KiUserCallbackDispatcherContinue()    Unknown
     win32u.dll!NtUserGetMessage()    Unknown
     user32.dll!GetMessageW()    Unknown
     CommandBarsSample.exe!AfxInternalPumpMessage() Line 153    C++
     CommandBarsSample.exe!CWinThread::Run() Line 629    C++
     CommandBarsSample.exe!AfxWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 61    C++
     [Inline Frame] CommandBarsSample.exe!invoke_main() Line 118    C++
     CommandBarsSample.exe!__scrt_common_main_seh() Line 288    C++
     kernel32.dll!BaseThreadInitThunk()    Unknown
     ntdll.dll!RtlUserThreadStart()    Unknown

I really need a fix for this, both in debug and release.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.027 seconds.