![]() |
Crash on PaintManager destructor |
Post Reply
|
| Author | |
k_shehadeh
Newbie
Joined: 19 August 2005 Location: United States Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Topic: Crash on PaintManager destructorPosted: 24 January 2007 at 3:28pm |
|
I'm seeing a crash with the following stack when I shutdown my application:
mfc80d.dll!AfxImageList_Destroy(_IMAGELIST * himl=0x0019d148) mfc80d.dll!CImageList::DeleteImageList() C++ mfc80d.dll!CImageList::~CImageList() ToolkitPro1031vc80D.dll!XTPPaintThemes::CXTPOffice2003Theme::~CXTPOffice2003Theme() ToolkitPro1031vc80D.dll!XTPPaintThemes::CXTPOffice2003Theme::`vector deleting destructor'() mfc80d.dll!CCmdTarget::OnFinalRelease() mfc80d.dll!CCmdTarget::InternalRelease() ToolkitPro1031vc80D.dll!CXTPPaintManager::Done() ToolkitPro1031vc80D.dll!CXTPPaintManager::CPaintManagerDestructor::~CPaintManagerDestructor() The crash is occuring because m_hImageList is NULL inside of the CImageList class. What's interesting is that the class checks for NULL just before it calls AfxImageList_Destroy. This began happening when I added code to a view that puts a CXTPToolBar at the top of the window. In the OnCreate of my CView-derived class I added the following code: m_wndCameraToolBar.CreateToolBar(WS_TABSTOP|WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, this) m_wndCameraToolBar.SetOwner (this); m_wndCameraToolBar.LoadToolBar(IDR_CAMERA_TOOLBAR); Where IDR_CAMERA_TOOLBAR is a toolbar resource that has button names that are the same as some button names in the main application toolbar (I think that might be relevant). When I remove the code above, the crash no longer happens. I know this is a somewhat complicated situation to describe so I modified one of the CodeJock samples that does the same thing (but doesn't crash). The fact that the sample doesn't crash suggests that there's something else going on. Here is some other information that might be relevant: 1) The main app used codejock and mfc dynamically 2) The main app loads a DLL that also uses codejock and mfc dynamically 3) There is one other toolbar in the application that are created and used this way but instead of using LoadToolbar, it does this: CXTPImageManager objecttypes; objecttypes.SetIcons (IDR_OBJECT_TYPES); m_wndToolBar.GetImageManager ()->AddIcons (&objecttypes); See linked file for an example of what I'm trying to do (see CGUI_VisualStudio7View::OnCreate for new code): http://iwonderdesigns.com/downloads/GUI_VisualStudio7.zip Thanks for your help, Karim |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 January 2007 at 1:09am |
|
Hi, think problem that dll and main application use diffrent paintmanagers.
try to call pPaintManager->Done() ; in your dll manually.
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
k_shehadeh
Newbie
Joined: 19 August 2005 Location: United States Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 January 2007 at 8:54am |
|
At what point in the DLL should I call Done in the DLL? Should it be in the applicaiton object's ExitInstance? And what's the best way to access the paint manager for the DLL? Is it a global object?
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 January 2007 at 1:47pm |
|
Hello, yes, think ExitInstance good place. call
XTPPaintManager()->Done();
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
k_shehadeh
Newbie
Joined: 19 August 2005 Location: United States Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 January 2007 at 2:06pm |
|
Hm. I tried that and now I'm getting a crash in a different place during the ExitInstance stack but still inside some paintmanager code:
void CXTPWinThemeWrapper::CloseThemeData() { if (m_hTheme && !m_bDllDetached) { TRY_POINTER_CALL(CloseThemeData) POINTER_CALL(m_hTheme); CATCH_POINTER_CALL() } m_hTheme = NULL; } ... with the following stack: uxtheme.dll!CAutoCS::CAutoCS() + 0x11 bytes uxtheme.dll!CRenderList::CloseRenderObject() + 0x16 bytes uxtheme.dll!_CloseThemeData@4() + 0x1f bytes > ToolkitPro1031vc80D.dll!CXTPWinThemeWrapper::CloseThemeData() Line 106 + 0xc bytes C++ ToolkitPro1031vc80D.dll!CXTPWinThemeWrapper::~CXTPWinThemeWrapper() Line 82 C++ ToolkitPro1031vc80D.dll!CXTPControlGalleryPaintManager::~CXTPControlGalleryPaintManager() + 0x2e bytes C++ ToolkitPro1031vc80D.dll!CXTPControlGalleryPaintManager::`scalar deleting destructor'() + 0x2b bytes C++ ToolkitPro1031vc80D.dll!CXTPPaintManager::~CXTPPaintManager() Line 160 + 0x31 bytes C++ ToolkitPro1031vc80D.dll!XTPPaintThemes::CXTPOfficeTheme::~CXTPOfficeTheme() + 0x2b bytes C++ ToolkitPro1031vc80D.dll!XTPPaintThemes::CXTPOffice2003Theme::~CXTPOffice2003Theme() Line 67 + 0x1d bytes C++ ToolkitPro1031vc80D.dll!XTPPaintThemes::CXTPOffice2003Theme::`vector deleting destructor'() + 0x6c bytes C++ mfc80d.dll!CCmdTarget::OnFinalRelease() Line 579 + 0x21 bytes C++ mfc80d.dll!CCmdTarget::InternalRelease() Line 138 C++ ToolkitPro1031vc80D.dll!CXTPPaintManager::Done() Line 254 C++ typhon.dll!CTyphonApp::ExitInstance() Line 70 + 0xd bytes C++ |
|
![]() |
|
k_shehadeh
Newbie
Joined: 19 August 2005 Location: United States Status: Offline Points: 10 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 January 2007 at 12:07pm |
|
While it didn't work in Exit Instance of the DLL, calling it in the deinit of the main application did work. Thanks!
(Though I'm still not clear what the source of the problem is) |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 January 2007 at 2:21pm |
|
Hi, You have debug strings of uxtheme.dll? How?? Where? :)
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Sven
Senior Member
Joined: 21 August 2003 Location: Germany Status: Offline Points: 127 |
Post Options
Thanks(0)
Quote Reply
Posted: 28 January 2007 at 5:37am |
|
Add http://msdl.microsoft.com/download/symbols as symbol directory in VC8 you will get debug information for all Windows dll's.
|
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 29 January 2007 at 1:02am |
|
Thanks! :)
|
|
|
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 |