Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Crash in release mode
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Crash in release mode

 Post Reply Post Reply
Author
Message
rock View Drop Down
Groupie
Groupie


Joined: 27 October 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote rock Quote  Post ReplyReply Direct Link To This Post Topic: Crash in release mode
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 November 2006 at 12:48am
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
Back to Top
rock View Drop Down
Groupie
Groupie


Joined: 27 October 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote rock Quote  Post ReplyReply Direct Link To This Post Posted: 15 November 2006 at 3:01pm
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
Back to Top
rock View Drop Down
Groupie
Groupie


Joined: 27 October 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote rock Quote  Post ReplyReply Direct Link To This Post Posted: 20 November 2006 at 11:41am
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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 20 November 2006 at 1:55pm
Hi,
 
Thanks for sharing.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.109 seconds.