GDI leak when closing last document tab in an MDI application - by Patrick Scherz

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 718189 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/12/2012 1:22:21 AM
Access Restriction Public


In an MFC application with tabbed documents there will always stay 10 GDI font handles if you closed the only tab and opened a new document. It will only allocate those 10 handles if it is the first tab that is opened.

We discovered this error because we have to open and close very many documents sequentially. When we reach about the 950th iteration of opening and closing the only tab the gdi handle count reaches 10000 and the application raises a CResourceException.

Currently we are using a workaround to prevent this from happening. We open one empty document, then do our tasks and close this empty document afterwards.
Sign in to post a comment.
Posted by Microsoft on 1/17/2012 at 11:45 AM
Hello Patrick,

Thanks for the report. This issue has been fixed in MFC for the next major release of Visual Studio. The MFC application can opt to reuse the CMFCTabCtrl windows in the MDI client area window via a new CMDITabInfo member variable named m_bReuseRemovedTabGroups.

Pat Brenner
Visual C++ Libraries Development
Posted by EricLeong [Feedback Moderator] on 1/12/2012 at 7:08 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 1/12/2012 at 1:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(