Crash in release mode |
Post Reply |
Author | |
rock
Groupie Joined: 27 October 2005 Status: Offline Points: 19 |
Post Options
Thanks(0)
Posted: 14 November 2006 at 5:44pm |
I have an application built with VS 2005 that works fine in debug build, but release build crashes in CMainFrame::OnCreate() when calling
pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
By turning on debug in my app & the Toolkit library I was able to track down what is happening. Here is the call stack at the time of the crash:
00000077()
ToolkitPro1031vc80.dll!CComCtlWrapper::_ImageList_AddMasked() + 0x8a bytes C++ ToolkitPro1031vc80.dll!CXTPImageManager::SetIcons() + 0x2d2 bytes C++ ToolkitPro1031vc80.dll!CXTPImageManager::SetIcons() + 0xba bytes C++ ToolkitPro1031vc80.dll!CXTPImageManager::SetIcons() + 0x24 bytes C++ ToolkitPro1031vc80.dll!CXTPMenuBar::LoadMenuBar() + 0x125 bytes C++ ToolkitPro1031vc80.dll!CXTPCommandBars::SetMenu() + 0x6c bytes C++ > Asksam.exe!CMainFrame::OnCreate(tagCREATESTRUCTA * lpCreateStruct=0x00d4c868) Line 1767 + 0x13 bytes C++ It appears that the Toolkit cannot load the resource XTP_IDB_MENUBAR_ICONS in LoadMenuBar().
I've tried calling XTPResourceManager()->SetResourceFile(_T("ToolkitPro1031vc80.dll")); within OnCreate() but it still crashes.
To make localization easier this application has a resource dll that is loaded in InitInstance() with AfxLoadLibrary(strResDLL), then set using AfxSetResourceHandle(m_hInstResDLL)
I've added #include <ToolkitPro.rc> to my rc2 file, but the result is the same. I even added the #include directly to the "Compile-time Directives". No luck still crashes in release build.
I'm stumpted. Its probably not a Toolkit problem, but any help would be appreciated.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
I don't think it is in toolkit.... try to isolate problem to remove as much code as you can and attach project in issuetrack or here.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rock
Groupie Joined: 27 October 2005 Status: Offline Points: 19 |
Post Options
Thanks(0)
|
That won't be an easy task. Last time I checked, there were several 100,000s lines of code. Minimizing it and still have it work may not be possible. I've changed it so that the resources are included and not a separate DLL, but no change. I'm currently compiling with /anaylze turn on to see it anything shows up there.
Thanks
Kevin
|
|
rock
Groupie Joined: 27 October 2005 Status: Offline Points: 19 |
Post Options
Thanks(0)
|
The problem only exists with the mfc8 release shared dll and applications compiled using a setting other than the default "Struct Member Alignment" of 8 (/zp8).
By surrounding any and all "afx*" header files with #pragma statements fixes the problem:
#pragma pack(push, 8)
#include <afxwin.h>
#include <afxext.h>
#pragma pack(pop)
This is the same thing I had to do to get the ToolKit Pro to work properly too.
Kevin
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Thanks for sharing.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
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 |