<?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>60618</bug_id>
          
          <creation_ts>2011-05-11 03:26:14 -0700</creation_ts>
          <short_desc>WebView::performLayeredWindowUpdate() crashes with NULL pointer</short_desc>
          <delta_ts>2011-08-08 12:41:39 -0700</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 Misc.</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>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Heiner Wolf">wolf.heiner</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          <cc>aroben</cc>
    
    <cc>bfulgham</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>401891</commentid>
    <comment_count>0</comment_count>
    <who name="Heiner Wolf">wolf.heiner</who>
    <bug_when>2011-05-11 03:26:14 -0700</bug_when>
    <thetext>m_backingStoreBitmap can be NULL causing -&gt;handle() to fail. This happens when I resize (quickly?) to (0,0). I am using a sizer-div and move it quickly to the topleft corner of the window and beyond. The sizer-div calls ::MoveWindow(). The crash does not always happen. Maybe it&apos;s a timing issue. If I resize slowly, then it does not crash. This lets me assume, that it only happens, when there comes a second ::MoveWindow(width=0,height=0) after sizing to (0,0). Maybe m_backingStoreBitmap is discarded for size (0,0). WebView::performLayeredWindowUpdate() should probably have a if(m_backingStoreBitmap!=NULL), anyway.

http://svn.webkit.org/repository/webkit/trunk
Revision: 85004

Method:
  void WebView::performLayeredWindowUpdate()
crashes when accessing
  m_backingStoreBitmap-&gt;handle()
with 
  m_backingStoreBitmap = 0


Stack trace:
&gt;	WebKit_debug.dll!WebCore::RefCountedGDIHandle&lt;HBITMAP__ *&gt;::handle()  Line 51 + 0x3 bytes	C++
 	WebKit_debug.dll!WebView::performLayeredWindowUpdate()  Line 1001 + 0x12 bytes	C++
 	WebKit_debug.dll!WebView::WebViewWndProc(HWND__ * hWnd=0x000b0b78, unsigned int message=15, unsigned int wParam=0, long lParam=0)  Line 2130	C++
 	user32.dll!76bcc4e7() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]	
 	user32.dll!76bc5f9f() 	
 	user32.dll!76bcc590() 	
 	user32.dll!76bc4f0e() 	
 	user32.dll!76bc4f7d() 	
 	ntdll.dll!77816fee() 	
 	user32.dll!76bc4ec3() 	
 	user32.dll!76bc1be4() 	
 	user32.dll!76bbffcd() 	
 	WebKit_debug.dll!WebView::repaint(const WebCore::IntRect &amp; windowRect={...}, bool contentChanged=false, bool immediate=true, bool repaintContentOnly=false)  Line 756 + 0xf bytes	C++
 	WebKit_debug.dll!WebChromeClient::invalidateWindow(const WebCore::IntRect &amp; windowRect={...}, bool immediate=true)  Line 470	C++
 	WebKit_debug.dll!WebCore::Chrome::invalidateWindow(const WebCore::IntRect &amp; updateRect={...}, bool immediate=true)  Line 71 + 0x20 bytes	C++
 	WebKit_debug.dll!WebCore::ScrollView::scrollContents(const WebCore::IntSize &amp; scrollDelta={...})  Line 663 + 0x3f bytes	C++
 	WebKit_debug.dll!WebCore::ScrollView::scrollTo(const WebCore::IntSize &amp; newOffset={...})  Line 366	C++
 	WebKit_debug.dll!WebCore::FrameView::scrollTo(const WebCore::IntSize &amp; newOffset={...})  Line 2109	C++
 	WebKit_debug.dll!WebCore::ScrollView::setScrollOffset(const WebCore::IntPoint &amp; offset={...})  Line 351 + 0x17 bytes	C++
 	WebKit_debug.dll!WebCore::ScrollableArea::setScrollOffsetFromAnimation(const WebCore::IntPoint &amp; offset={...})  Line 133 + 0x13 bytes	C++
 	WebKit_debug.dll!WebCore::ScrollAnimator::notityPositionChanged()  Line 130	C++
 	WebKit_debug.dll!WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation(const WebCore::FloatPoint &amp; offset={...})  Line 80 + 0xf bytes	C++
 	WebKit_debug.dll!WebCore::ScrollableArea::scrollToOffsetWithoutAnimation(const WebCore::FloatPoint &amp; offset={...})  Line 97 + 0x21 bytes	C++
 	WebKit_debug.dll!WebCore::ScrollView::updateScrollbars(const WebCore::IntSize &amp; desiredOffset={...})  Line 592	C++
 	WebKit_debug.dll!WebCore::ScrollView::setScrollPosition(const WebCore::IntPoint &amp; scrollPoint={...})  Line 402	C++
 	WebKit_debug.dll!WebCore::FrameView::setScrollPosition(const WebCore::IntPoint &amp; scrollPoint={...})  Line 1457	C++
 	WebKit_debug.dll!WebCore::RenderLayer::scrollRectToVisible(const WebCore::IntRect &amp; rect={...}, bool scrollToAnchor=false, const WebCore::ScrollAlignment &amp; alignX={...}, const WebCore::ScrollAlignment &amp; alignY={...})  Line 1482	C++
 	WebKit_debug.dll!WebCore::RenderLayer::autoscroll()  Line 1586	C++
 	WebKit_debug.dll!WebCore::RenderBox::autoscroll()  Line 660	C++
 	WebKit_debug.dll!WebCore::EventHandler::autoscrollTimerFired(WebCore::Timer&lt;WebCore::EventHandler&gt; * __formal=0x032a42b0)  Line 798 + 0x21 bytes	C++
 	WebKit_debug.dll!WebCore::Timer&lt;WebCore::EventHandler&gt;::fired()  Line 100 + 0x23 bytes	C++
 	WebKit_debug.dll!WebCore::ThreadTimers::sharedTimerFiredInternal()  Line 112 + 0xf bytes	C++
 	WebKit_debug.dll!WebCore::ThreadTimers::sharedTimerFired()  Line 91	C++
 	WebKit_debug.dll!WebCore::TimerWindowWndProc(HWND__ * hWnd=0x00040a4c, unsigned int message=49797, unsigned int wParam=0, long lParam=0)  Line 103 + 0x8 bytes	C++</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402078</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2011-05-11 10:21:24 -0700</bug_when>
    <thetext>Heiner, is this happening in an application that is using layered window mode? If so, which application?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402699</commentid>
    <comment_count>2</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-05-11 23:26:05 -0700</bug_when>
    <thetext>Hi Adam,

(In reply to comment #1)
&gt; Heiner, is this happening in an application that is using layered window mode? If so, which application?

I asked Heiner to file this bug.  It&apos;s happening in an application he&apos;s working on, and I wanted to open an issue to track a correction for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402813</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2011-05-12 06:43:55 -0700</bug_when>
    <thetext>Sounds good. I just wanted to make sure we weren&apos;t going down the layered window path by accident.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402816</commentid>
    <comment_count>4</comment_count>
    <who name="Heiner Wolf">wolf.heiner</who>
    <bug_when>2011-05-12 06:55:11 -0700</bug_when>
    <thetext>I am working on my own application using WebKit.dll, etc. It is based on Brent&apos;s recent transparency patch. The transparency code is very new, has not seen may users, so it&apos;s no surprise, that some edge cases come up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>447454</commentid>
    <comment_count>5</comment_count>
      <attachid>103124</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-08-05 15:50:45 -0700</bug_when>
    <thetext>Created attachment 103124
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>448018</commentid>
    <comment_count>6</comment_count>
      <attachid>103124</attachid>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2011-08-08 08:38:46 -0700</bug_when>
    <thetext>Comment on attachment 103124
Patch

When do we expect this case to get hit? It would be worth mentioning it in the ChangeLog and/or a comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>448112</commentid>
    <comment_count>7</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-08-08 11:06:13 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (From update of attachment 103124 [details])
&gt; When do we expect this case to get hit? It would be worth mentioning it in the ChangeLog and/or a comment.

The &apos;ensureBackingStore&apos; method will not produce a backing store in cases where the window rect is zero height or zero width.  I think Heiner ran into this during certain resize operations; it may be that a paint message is getting processed after the window rect has collapsed to zero height (or width).

Based on his earlier comments (2011-05-11 03:26:14), it seems to trigger when the window is sized to (0,0) (which we know destroys the backing store), followed by a MoveWindow, which must be generating a paint.

It might be that this could be addressed by avoiding the second paint message getting to the &apos;performLayeredWindowUpdate&apos;, but it seemed easiest to just check for NULL backing store and bail out early if necessary.

Do you think deeper analysis of the drawing logic is warranted here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>448116</commentid>
    <comment_count>8</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2011-08-08 11:08:39 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; (From update of attachment 103124 [details] [details])
&gt; &gt; When do we expect this case to get hit? It would be worth mentioning it in the ChangeLog and/or a comment.
&gt; 
&gt; The &apos;ensureBackingStore&apos; method will not produce a backing store in cases where the window rect is zero height or zero width.  I think Heiner ran into this during certain resize operations; it may be that a paint message is getting processed after the window rect has collapsed to zero height (or width).
&gt; 
&gt; Based on his earlier comments (2011-05-11 03:26:14), it seems to trigger when the window is sized to (0,0) (which we know destroys the backing store), followed by a MoveWindow, which must be generating a paint.

Makes sense.

&gt; It might be that this could be addressed by avoiding the second paint message getting to the &apos;performLayeredWindowUpdate&apos;, but it seemed easiest to just check for NULL backing store and bail out early if necessary.
&gt; 
&gt; Do you think deeper analysis of the drawing logic is warranted here?

I suggest we do as little work as possible when the window is 0-sized. The null-check seems fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>448185</commentid>
    <comment_count>9</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2011-08-08 12:41:39 -0700</bug_when>
    <thetext>Committed r92621: &lt;http://trac.webkit.org/changeset/92621&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>103124</attachid>
            <date>2011-08-05 15:50:45 -0700</date>
            <delta_ts>2011-08-08 08:38:45 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-60618-20110805155045.patch</filename>
            <type>text/plain</type>
            <size>1266</size>
            <attacher name="Brent Fulgham">bfulgham</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJLaXQvd2luL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2Uv
V2ViS2l0L3dpbi9DaGFuZ2VMb2cJKHJldmlzaW9uIDkyNTE4KQorKysgU291cmNlL1dlYktpdC93
aW4vQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTUgQEAKKzIwMTEtMDgtMDUg
IEJyZW50IEZ1bGdoYW0gIDxiZnVsZ2hhbUB3ZWJraXQub3JnPgorCisgICAgICAgIFdlYlZpZXc6
OnBlcmZvcm1MYXllcmVkV2luZG93VXBkYXRlKCkgY3Jhc2hlcyB3aXRoCisgICAgICAgIE5VTEwg
cG9pbnRlci4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lk
PTYwNjE4CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
KiBXZWJWaWV3LmNwcDoKKyAgICAgICAgKFdlYlZpZXc6OnBlcmZvcm1MYXllcmVkV2luZG93VXBk
YXRlKTogQWRkIGFuIGVhcmx5CisgICAgICAgICByZXR1cm4gd2hlbiB0aGVyZSBpcyBubyBiYWNr
aW5nIHN0b3JlIHRvIGJsZW5kIHdpdGguCisKIDIwMTEtMDgtMDUgIEFuZGVycyBDYXJsc3NvbiAg
PGFuZGVyc2NhQGFwcGxlLmNvbT4KIAogICAgICAgICBSZW1vdmUgUGx1Z2luSGFsdGVyCkluZGV4
OiBTb3VyY2UvV2ViS2l0L3dpbi9XZWJWaWV3LmNwcAo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
S2l0L3dpbi9XZWJWaWV3LmNwcAkocmV2aXNpb24gOTI0OTkpCisrKyBTb3VyY2UvV2ViS2l0L3dp
bi9XZWJWaWV3LmNwcAkod29ya2luZyBjb3B5KQpAQCAtMTAwMCw2ICsxMDAwLDkgQEAgdm9pZCBX
ZWJWaWV3Ojp1cGRhdGVCYWNraW5nU3RvcmUoRnJhbWVWaQogCiB2b2lkIFdlYlZpZXc6OnBlcmZv
cm1MYXllcmVkV2luZG93VXBkYXRlKCkKIHsKKyAgICBpZiAoIW1fYmFja2luZ1N0b3JlQml0bWFw
KQorICAgICAgICByZXR1cm47CisKICAgICBIREMgaGRjU2NyZWVuID0gOjpHZXREQyhtX3ZpZXdX
aW5kb3cpOwogICAgIE93blB0cjxIREM+IGhkY01lbSA9IGFkb3B0UHRyKDo6Q3JlYXRlQ29tcGF0
aWJsZURDKGhkY1NjcmVlbikpOwogICAgIEhCSVRNQVAgaGJtT2xkID0gc3RhdGljX2Nhc3Q8SEJJ
VE1BUD4oOjpTZWxlY3RPYmplY3QoaGRjTWVtLmdldCgpLCBtX2JhY2tpbmdTdG9yZUJpdG1hcC0+
aGFuZGxlKCkpKTsK
</data>
<flag name="review"
          id="98606"
          type_id="1"
          status="+"
          setter="aroben"
    />
          </attachment>
      

    </bug>

</bugzilla>