Crash inside CXTPFontDC::SetFont() |
Post Reply |
Author | |
akur
Senior Member Joined: 16 May 2006 Status: Offline Points: 139 |
Post Options
Thanks(0)
Posted: 17 September 2007 at 2:43am |
Hello,
we've got access violation crashes inside the CXTPFontDC class. This is how the call stack looks like (excerpt from a Release build's crashdump): It happens sporadically from time to time (like once a week), but on 3 different computers at least. All these computers run Vista Business or Vista Ultimate and all of them are dual-core processors. Don't know if it matters. Do you have any idea how to fix or any workaround for this? Thanks a lot, in advance! |
|
akur
Senior Member Joined: 16 May 2006 Status: Offline Points: 139 |
Post Options
Thanks(0)
|
The call stack comes from processing WM_PRINT or WM_PRINTCLIENT messages which is what e.g. plain combobox controls are sent to on Vista systems when you e.g. hover your mouse over them. However, the crash doesn't happen during hovering. It just happens when working with any other parts of the application.
We have one such plain combobox inserted as a custom control in an XTP toolbar. Do you think this can cause any problems somehow? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Looking to code and call stack I can say that it can happen only if something send not valid device context with WM_PRINT message.
try to remove this comboxbox and check if problem can be reproduced. May be you can replace it to our CXTPControlComboBox ?
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
akur
Senior Member Joined: 16 May 2006 Status: Offline Points: 139 |
Post Options
Thanks(0)
|
Hello,
the WM_PRINT is sent by the system (Vista) itself, so I guess the device context should be valid. Plus, its validity is checked in your code inside CXTPCommandBar::DrawCommandBar(), so I think this is not the problem. However, maybe the CDC object itself - acquired inside CXTPCommandBar::OnPrint() - can be deleted somehow, thus a non-valid object is dereferenced inside the ctor of CXTPFontDC. What do you think, how can this happen? I've got no good explanation for this, since MFC should delete temporary CDC objects only during OnIdle() - but that's _not_ our case, since we're still inside the processing of the same WM_PRINT message. I'm affraid we cannot replace our specialized, owner-draw combobox with a CXTPControl-based class. Do you have any other idea how to get around this crash? Thank you, in advance! |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Please try to rewrite CXTPCommandBar::OnPrintClient as
CDC dc;
dc.Attach((HDC)wParam); DrawCommandBar(&dc, CXTPClientRect(this)); dc.Detach(); and check if you can reproduce it.
Thanks
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
akur
Senior Member Joined: 16 May 2006 Status: Offline Points: 139 |
Post Options
Thanks(0)
|
Thanks for the suggestion - it helped to avoid the crash so far.
I guess there must be some problem with how MFC maintains its map of temporary CDC objects. |
|
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 |