Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPFramePaintManager::DrawFrame crash
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPFramePaintManager::DrawFrame crash

 Post Reply Post Reply
Author
Message
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Topic: CXTPFramePaintManager::DrawFrame crash
    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....
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 January 2009 at 2:47am
Hi,
Do you have frames in multiple threads ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post 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.
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: 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
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2009 at 4:46pm
I don't manually set any paint manager on any frame - so whatever the default is.
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: 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
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post 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.
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: 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
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 29 January 2009 at 8:02am
OK thanks, I'll try that.

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.125 seconds.