<?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>62836</bug_id>
          
          <creation_ts>2011-06-16 18:10:59 -0700</creation_ts>
          <short_desc>REGRESSION (r89035): HTMLTableRowsCollection constructor crashes; depends on compiler order of evaluation</short_desc>
          <delta_ts>2011-06-17 09:25:49 -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>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Darin Adler">darin</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>422368</commentid>
    <comment_count>0</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-06-16 18:10:59 -0700</bug_when>
    <thetext>This code is wrong:

HTMLTableRowsCollection::HTMLTableRowsCollection(PassRefPtr&lt;HTMLTableElement&gt; table)
    : HTMLCollection(table, OtherCollection, table-&gt;collectionCache())
{
}

If the first argument is evaluated first, then the second may dereference null because of the semantics of PassRefPtr. The fix is simple.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422372</commentid>
    <comment_count>1</comment_count>
      <attachid>97533</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-06-16 18:15:16 -0700</bug_when>
    <thetext>Created attachment 97533
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422373</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-06-16 18:17:04 -0700</bug_when>
    <thetext>Committed r89096: &lt;http://trac.webkit.org/changeset/89096&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422421</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-06-16 22:40:31 -0700</bug_when>
    <thetext>Should the HTMLTableRowsCollection constructor just be changed to take a raw pointer?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422636</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-06-17 08:20:02 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Should the HTMLTableRowsCollection constructor just be changed to take a raw pointer?

Since the function does take ownership of a reference, the PassRefPtr optimization works, so I think it&apos;s good to take a smart pointer, even though in this case we can’t take advantage of it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422650</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-06-17 09:00:10 -0700</bug_when>
    <thetext>The only caller of HTMLTableRowsCollection::create() passes &quot;this&quot; to this function, and I don&apos;t see how any caller could possibly pass ownership of HTMLTableElement to HTMLTableRowsCollection.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>422658</commentid>
    <comment_count>6</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-06-17 09:25:49 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; The only caller of HTMLTableRowsCollection::create() passes &quot;this&quot; to this function, and I don&apos;t see how any caller could possibly pass ownership of HTMLTableElement to HTMLTableRowsCollection.

RefPtr implements a shared ownership model. The function does take ownership.

On the other hand, if nobody ever takes advantage of it, I think it’s fine to use raw pointers instead.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>97533</attachid>
            <date>2011-06-16 18:15:16 -0700</date>
            <delta_ts>2011-06-16 18:16:32 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-62836-20110616181514.patch</filename>
            <type>text/plain</type>
            <size>1719</size>
            <attacher name="Darin Adler">darin</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDg5MDk1KQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTcgQEAKKzIwMTEtMDYtMTYgIERhcmluIEFk
bGVyICA8ZGFyaW5AYXBwbGUuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09Q
UyEpLgorCisgICAgICAgIFJFR1JFU1NJT04gKHI4OTAzNSk6IEhUTUxUYWJsZVJvd3NDb2xsZWN0
aW9uIGNvbnN0cnVjdG9yIGNyYXNoZXM7IGRlcGVuZHMgb24gY29tcGlsZXIgb3JkZXIgb2YgZXZh
bHVhdGlvbgorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9
NjI4MzYKKworICAgICAgICBDb3ZlcmVkIGJ5IGV4aXN0aW5nIHRlc3RzIG9uIHBsYXRmb3JtcyB3
aGVyZSBpdCBvY2N1cnMuCisKKyAgICAgICAgKiBodG1sL0hUTUxUYWJsZVJvd3NDb2xsZWN0aW9u
LmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OkhUTUxUYWJsZVJvd3NDb2xsZWN0aW9uOjpIVE1MVGFi
bGVSb3dzQ29sbGVjdGlvbik6IEFkZCBhI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cGlsZXJzLgogSFRNTFRh
YmxlUm93c0NvbGxlY3Rpb246OkhUTUxUYWJsZVJvd3NDb2xsZWN0aW9uKFBhc3NSZWZQdHI8SFRN
TFRhYmxlRWxlbWVudD4gdGFibGUpCi0gICAgOiBIVE1MQ29sbGVjdGlvbih0YWJsZSwgT3RoZXJD
b2xsZWN0aW9uLCB0YWJsZS0+Y29sbGVjdGlvbkNhY2hlKCkpCisgICAgOiBIVE1MQ29sbGVjdGlv
bih0YWJsZS5nZXQoKSwgT3RoZXJDb2xsZWN0aW9uLCB0YWJsZS0+Y29sbGVjdGlvbkNhY2hlKCkp
CiB7CiB9CiAK
</data>
<flag name="review"
          id="91509"
          type_id="1"
          status="+"
          setter="mitz"
    />
          </attachment>
      

    </bug>

</bugzilla>