Bug 76604 - [windows] GDI DC isn't restored to default state before deleting/releasing.
Summary: [windows] GDI DC isn't restored to default state before deleting/releasing.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-18 21:58 PST by David Levin
Modified: 2012-01-18 21:58 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Levin 2012-01-18 21:58:56 PST
When I was doing the fix for 76303, I noticed this issue in a few places:
  http://trac.webkit.org/browser/trunk/Source/WebCore/platform/win/DragImageWin.cpp#L201
  http://trac.webkit.org/browser/trunk/Source/WebKit/win/WebNodeHighlight.cpp#L157

There are a few things that could be done:
1. One could bake in SaveDC/RestoreDC into HWndDC and OwnPtr<HDC> -- likely OwnPtr<HDC> should become something else. Ideally paired with removing the code which restores state already.
2. One could put in checks into HWndDC and OwnPtr<HDC> to assert that the hdc is at its default state. (The state it was at when it was given to the class.)

#1 seems the least error prone (and likely not very expensive these days).

I'll leave this fix/decision up to people who work on this platform more often than I do.