<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>76135</bug_id>
          
          <creation_ts>2012-01-11 17:53:06 -0800</creation_ts>
          <short_desc>[Chromium] REGRESSION(102301): DC leak introduced in WebScreenInfoFactory</short_desc>
          <delta_ts>2012-01-18 21:29:16 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit API</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows 7</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>76203</dependson>
    
    <dependson>76227</dependson>
    
    <dependson>76237</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Larson (Google)">mal</reporter>
          <assigned_to name="David Levin">levin</assigned_to>
          <cc>fsamuel</cc>
    
    <cc>levin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>534462</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Larson (Google)">mal</who>
    <bug_when>2012-01-11 17:53:06 -0800</bug_when>
    <thetext>See also http://bugs.chromium.org/109768

http://trac.webkit.org/changeset/102301 introduces a leak of GDI handles in Chromium.

In some cases, extensions that call screen.width/height repeatedly can exhaust GDI handles very quickly leading to a browser crash.

I think all you need to do is introduce a ReleaseDC(0, hdc) call before you return in /Source/WebKit/chromium/src/win/WebScreenInfoFactory.cpp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534474</commentid>
    <comment_count>1</comment_count>
    <who name="David Levin">levin</who>
    <bug_when>2012-01-11 18:14:05 -0800</bug_when>
    <thetext>I&apos;ve got it. It is a simple fix. I&apos;m working on a test for it right now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>534833</commentid>
    <comment_count>2</comment_count>
    <who name="Fady Samuel">fsamuel</who>
    <bug_when>2012-01-12 07:44:45 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; I&apos;ve got it. It is a simple fix. I&apos;m working on a test for it right now.

Sorry, forgot the ReleaseDC (I don&apos;t do a lot of Windows development lately). I&apos;m not sure how one tests memory leaks in WebKit however.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>538459</commentid>
    <comment_count>3</comment_count>
    <who name="David Levin">levin</who>
    <bug_when>2012-01-18 21:29:16 -0800</bug_when>
    <thetext>Well I was going to introduce a test by calling the screen methods about 1000 or so times which is really fast in practice.

It turns out that the DRT doesn&apos;t ever call the problematic function, so I was going to fix that but that function is different on every platform so it is a larger problem.

Ideally the real screen functions would be called from the test to ensure there were no crashes, but I;m satisfied with having put in a check into check-webkit-style which will flag if anyone calls GetDC directly so it is unlikely that a leak of this type will ever be introduced again.

The depends on bugs are about getting rid of current instances of GetDC. (They technically are only related so I&apos;m going to resolve this bug -- They are fixed and just pending review also.)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>