<?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>54262</bug_id>
          
          <creation_ts>2011-02-10 17:51:54 -0800</creation_ts>
          <short_desc>Some Scrollbar functions assume an attached ScrollableArea but can be called without one</short_desc>
          <delta_ts>2011-02-13 10:47:03 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</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>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Kasting">pkasting</reporter>
          <assigned_to name="Sam Weinig">sam</assigned_to>
          <cc>jamesr</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>349542</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2011-02-10 17:51:54 -0800</bug_when>
    <thetext>EventHandler caches |m_lastScrollbarUnderMouse| while the user is interacting with a scrollbar.  This can cause problems if, during this interaction, the page goes through relayout and destroys its scrollbar.

Because |m_lastScrollbarUnderMouse| is a RefPtr, we don&apos;t need to worry about it being deleted.  However, in RenderLayer::destroyScrollbar(), scrollbar-&gt;disconnectFromScrollableArea() is called before the RenderLayer drops its ref.  As a result, the scrollbar no longer has an attached ScrollableArea.  The next time EventHandler calls e.g. Scrollbar::mouseMoved(), it blindly accesses scrollableArea() and we crash.

I don&apos;t know the model here well enough to know whether the right fix is for the Scrollbar to add NULL-checks in several places, or whether instead at the time the scrollbar is dropped from the RenderLayer the EventHandler should be told to drop |m_lastScrollbarUnderMouse|, or perhaps something else.

I don&apos;t have a minimal testcase that reproduces this bug, but I imagine a page that either continually flips between needing a scrollbar and not on a timer, or else one that turns of its scrollbar in response to onscroll, might be able to demonstrate this.  Setting up such a page and then grabbing the scroll thumb and dragging around might work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>349547</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2011-02-10 17:55:59 -0800</bug_when>
    <thetext>(BTW, I may not have a _minimal_ testcase, but I do have one, locally, that&apos;s Chromium-specific, so I&apos;m happy to test out any patches to fix.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>349554</commentid>
    <comment_count>2</comment_count>
    <who name="James Robinson">jamesr</who>
    <bug_when>2011-02-10 18:32:00 -0800</bug_when>
    <thetext>FYI this is a leading crasher on recent Chromium builds and does not seem restricted to any particular webpages (there are crash reports from youtube.com, facebook.com, google.*, etc).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>349846</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2011-02-11 10:57:53 -0800</bug_when>
    <thetext>I will add null checks to Scrollbar.  That is the correct way to fix this.  I should have a patch ready later today.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350409</commentid>
    <comment_count>4</comment_count>
      <attachid>82268</attachid>
    <who name="Sam Weinig">sam</who>
    <bug_when>2011-02-13 10:42:43 -0800</bug_when>
    <thetext>Created attachment 82268
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>350412</commentid>
    <comment_count>5</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2011-02-13 10:47:03 -0800</bug_when>
    <thetext>Fixed in r78431.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>82268</attachid>
            <date>2011-02-13 10:42:43 -0800</date>
            <delta_ts>2011-02-13 10:44:51 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>barFinal.diff</filename>
            <type>text/plain</type>
            <size>2532</size>
            <attacher name="Sam Weinig">sam</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDc4NDMwKQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTcgQEAKKzIwMTEtMDItMTMgIFNhbSBXZWlu
aWcgIDxzYW1Ad2Via2l0Lm9yZz4KKworICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMh
KS4KKworICAgICAgICBTb21lIFNjcm9sbGJhciBmdW5jdGlvbnMgYXNzdW1lIGFuIGF0dGFjaGVk
IFNjcm9sbGFibGVBcmVhIGJ1dCBjYW4gYmUgY2FsbGVkIHdpdGhvdXQgb25lCisgICAgICAgIGh0
dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD01NDI2MgorCisgICAgICAgIE1h
a2Ugc3VyZSB0aGF0IGFsbCBjYWxscyB0byB0aGUgc2Nyb2xsYWJsZSBhcmVhIGFyZSBudWxsIGNo
ZWNrZWQuCisKKyAgICAgICAgKiBwbGF0Zm9ybS9TY3JvbGxiYXIuY3BwOgorICAgICAgICAoV2Vi
Q29yZTo6U2Nyb2xsYmFyOjphdXRvc2Nyb2xsUHJlc3NlZFBhcnQpOgorICAgICAgICAoV2ViQ29y
ZTo6U2Nyb2xsYmFyOjptb3ZlVGh1bWIpOgorICAgICAgICAoV2ViQ29yZTo6U2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G91dEFuaW1h
dGlvbihtX29yaWVudGF0aW9uLCBtX2RyYWdPcmlnaW4pOworICAgICAgICB9IGVsc2UgewogICAg
ICAgICAgICAgbW92ZVRodW1iKG1fb3JpZW50YXRpb24gPT0gSG9yaXpvbnRhbFNjcm9sbGJhciA/
IAogICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRGcm9tQ29udGFpbmluZ1dpbmRvdyhldnQu
cG9zKCkpLngoKSA6CiAgICAgICAgICAgICAgICAgICAgICAgY29udmVydEZyb21Db250YWluaW5n
V2luZG93KGV2dC5wb3MoKSkueSgpKTsK
</data>
<flag name="review"
          id="73916"
          type_id="1"
          status="+"
          setter="mitz"
    />
          </attachment>
      

    </bug>

</bugzilla>