Print Page | Close Window

CXTPFramePaintManager::DrawFrame crash

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=13209
Printed Date: 27 September 2024 at 3:36pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPFramePaintManager::DrawFrame crash
Posted By: adrien
Subject: CXTPFramePaintManager::DrawFrame crash
Date Posted: 19 January 2009 at 9:28pm
Hi

I'm getting occasional crashes in this func, where it's trying to draw an image, and the pointer is not NULL, but points to an object that has been deleted.

E.g/.

               pImage = LoadImage(_T("FRAMEBOTTOMRIGHT"));
               if (pImage)
               {
                    rcSrc = pImage->GetSource(bActive ? 0 : 1, 2);
                    CRect rcBottomRight(rc.right - rcSrc.Width(), rc.bottom - rcSrc.Height(), rc.right, rc.bottom);
                    pImage->DrawImage(pDC, rcBottomRight, rcSrc, CRect(0, 0, 0, 0), 0xFF00FF);
               }


where pImage if you browse it is all 0xfeeefeee members.

how could this be deleted and still returned from LoadImage?

I'm using multiple frames with my app....

-------------
http://www.wingate.com - http://www.wingate.com



Replies:
Posted By: Oleg
Date Posted: 20 January 2009 at 2:47am
Hi,
Do you have frames in multiple threads ?


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


Posted By: adrien
Date Posted: 20 January 2009 at 4:51pm
Hi Oleg

yes, each frame has its own thread, else they don't work for things like updating UI etc.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: adrien
Date Posted: 20 January 2009 at 4:52pm
p.s. this crash happened when I closed one of the frames.

it was running in the debugger.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: Oleg
Date Posted: 21 January 2009 at 2:08am

Hi,

Do you have common PaintManager or each frame's commandbars has its own ?


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


Posted By: adrien
Date Posted: 27 January 2009 at 4:46pm
I don't manually set any paint manager on any frame - so whatever the default is.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: Oleg
Date Posted: 28 January 2009 at 1:41am
Hi,
 
Then try create individual PaintManager + its Images for separate frame:
 
pCommandBars->SetTheme(xtpThemeOffice2007);
((CXTPOffice2007Theme*)pCommandBars->GetPaintManager())->SetImages(pImages);


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


Posted By: adrien
Date Posted: 28 January 2009 at 5:03am
Hi Oleg

Sorry - I misunderstood you. I do already call pCommandBars->SetTheme(xtpThemeRibbon) for each frame.

I don't know where I should get pImages from though. They are all standard CodeJock resources - I don't have any images for the 2 items in the quick access toolbar.

I do have a few icons for the ribbon I set though.

-------------
http://www.wingate.com - http://www.wingate.com


Posted By: Oleg
Date Posted: 28 January 2009 at 7:12am
Hi,
 
 
The thing that now all PaintManagers share same CXTPOffice2007Image collection.
 
add variable for frame
CXTPOffice2007Images* m_pImages;
in constrcutor m_pImages = new CXTPOffice2007Images(); 
in destructor delete m_pImages
 
 
ans set for theme:
CXTPOffice2007Theme*)pCommandBars->GetPaintManager())->SetImages(m_pImages);


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


Posted By: adrien
Date Posted: 29 January 2009 at 8:02am
OK thanks, I'll try that.



-------------
http://www.wingate.com - http://www.wingate.com



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