Print Page | Close Window

Crash in release mode

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=5518
Printed Date: 04 October 2024 at 5:12pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Crash in release mode
Posted By: rock
Subject: Crash in release mode
Date 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.



Replies:
Posted By: Oleg
Date 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


Posted By: rock
Date 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


Posted By: rock
Date 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


Posted By: Oleg
Date Posted: 20 November 2006 at 1:55pm
Hi,
 
Thanks for sharing.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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