![]() |
Crash caused by XTPSkinManager |
Post Reply ![]() |
Author | |
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() Posted: 26 November 2011 at 10:04am |
My app uses
to skin it. I tried for two days to find the reason for a crash caused when my app closes and opens views, and finally pinned it to the skin manager. The problem causing the crash is that creating XTPCommandBars suddenly fails inside MFC, where the hooks created by MFC do not longer set the internal m_hWnd of CWnds correctly during Create or CreateEx. These MFC hooks are intercepted by the XTP skin manager. I can repro the effect by opening and closing and opening again a view my application creates. The view contains a ton of child windows, many of them using command bars and other CodeJock classes. My application uses several working threads, but none of them uses MFC classes or windows. When the problem appears, the view fails during creating child windows after firing many ASSERTS inside the Create / CreateEx methods. The failure can happen in command bars, in XTP tooltips and elsewhere. This is reproducible. As soon as I comment out the calls to the skin manager methods the problem goes away. I *think* this problem crept in with one of the latest updates. I have not changed anything with the skin manager handing in six months, but now I have this problem.
As soon as I comment out the three lines above (I call them in the ctor of CMainFrame) the problem is gone. I can close and open the view dozens of times without problems. Re-enabling the skinning cases the view to fail to create during create view / destroy view / create view. |
|
![]() |
|
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() |
BOOL CWnd::CreateEx(DWORD dwExStyle, LPCTSTR lpszClassName,
... if (!AfxUnhookWindowCreate()) PostNcDestroy(); // cleanup if CreateWindowEx fails too soon if (hWnd == NULL) return FALSE; ASSERT(hWnd == m_hWnd); // should have been set in send msg hook return TRUE; } |
|
![]() |
|
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() |
The problem only happens when I enable skinning for my application. As soon as I comment out the EnableCurrentThead() call, things work as before.
Could somebody from Codejock please at least respond to this, perhaps with some tips on where too look? Did you change anything with your message hooking code / skin manager recently. This error was not there in earlier releases XTP. The problem usually happen in XTP controls, e.g. dockbars: BOOL CXTPDockBar::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID) { ASSERT(pParentWnd != NULL); // save the xtp m_dwStyle = (dwStyle & CBRS_ALL); XTPBarPosition barPosition = GetPosition(); CString strWindowName = barPosition == xtpBarTop ? _T("xtpBarTop") : barPosition == xtpBarLeft ? _T("xtpBarLeft") : barPosition == xtpBarBottom ? _T("xtpBarBottom") : _T("xtpBarRight"); // This fails, Windows cannot create the window... return CWnd::Create(_T("XTPDockBar"), strWindowName, dwStyle, CXTPEmptyRect(), pParentWnd, nID); } |
|
![]() |
|
ABuenger ![]() Newbie ![]() ![]() Joined: 02 February 2006 Status: Offline Points: 1075 |
![]() ![]() ![]() ![]() ![]() |
Hi,
is it possible for you to reproduce the crash and provide a sample? Andre |
|
Codejock support
|
|
![]() |
|
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() |
I can reliably reproduce the crash in my application.
I'm not sure that it can be reproduced easily in a smaller sample. My application uses dozens of panels and many of these panels have command bars. All of these windows are hosted in a CMainFrame window, which is declared as class CMainFrame : public CXTPFrameWnd, CXTPOffice2007FrameHook In response to certain commands, CMainFrame closes all child windows and panels, and then re-opens them. This runs the same code that is run when the application closes and starts, e.g. it stores commandbar layouts and loads these layouts again. This never causes trouble if the application is closed and started. But when I do that without shutting down the application (the Codejock SkinManager remains running) the described problem with creating the command bars happens. Always. And always CreateWindow fails in one of the command bar classes, XTP status bar or toolbar or similar. |
|
![]() |
|
znakeeye ![]() Senior Member ![]() ![]() Joined: 26 July 2006 Status: Offline Points: 1672 |
![]() ![]() ![]() ![]() ![]() |
Hm. I sense a bad system-wide hook dll here. Look in the output window for suspect dlls being loaded. I know I had a similar problem with some Logitech mouse hook...ยจ When you find it, exclude it using the ExcludeModule() API. |
|
PokerMemento - http://www.pokermemento.com/
|
|
![]() |
|
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() |
Thanks for the tip, I will do that
![]() Hopefully the suggestions in the post you linked help. |
|
![]() |
|
MacW ![]() Senior Member ![]() Joined: 26 June 2007 Status: Offline Points: 253 |
![]() ![]() ![]() ![]() ![]() |
Unfortunately, this was not the reason.
No unusual DLLs are on the call stack when the XTP hooks crash. It always crashes in the creation of command bars, and only when I create the window containing all the panels and command bars the second time (after closing/destroying) it. Is there some way to trace what XTP is doing? Perhaps something is not initialized correctly. I wonder when this effect crept in because it worked for over a year. Not sure which XTP update causes the effect. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |