DeleteDC on mDC -> mDC still contains a non default object. nsDrawingSurfaceWin.cpp



Core Graveyard
GFX: Win32
13 years ago
9 years ago


(Reporter: Itay Perl, Unassigned)


Windows 2000

Firefox Tracking Flags

(Not tracked)




13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+

This is a very common programming error.
in mozilla\gfx\src\windows\nsDrawingSurfaceWin.cpp:
line 134: ::DeleteDC(mDC)
This is an error, because mDC must contain a default object when deleted.
for example, if you have something like:
CBrush brsh;
CBrush* poldBrsh;
brsh.CreateSolideBrush(...); //omitted for simplicity
poldBrsh = ::SelectObject(mDC, brsh);

-and then, before the end of the destructor, add-
::SelectObject(mDC, poldBrsh);

I see you did this on Bitmap. Please do this also on Font and Pen.

Reproducible: Always

Steps to Reproduce:

Error detected with BoundsChecker version 7.2.0
component ?


13 years ago
Assignee: firefox → win32
Component: General → GFX: Win32
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk

Comment 2

13 years ago
Well, there are news:
mDC contained a Font and a Pen when distructed (as shown in BoundsChecker)
Font is selected in mozilla\gfx\src\windows\nsRenderingContextWin.cpp Line 2602
and the Pen, in the same file - line 2665.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Last Resolved: 13 years ago
Resolution: --- → EXPIRED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.