Changeset 53678 in webkit


Ignore:
Timestamp:
Jan 21, 2010 10:21:55 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-21 James Robinson <jamesr@chromium.org>

Reviewed by Darin Fisher.

Bumps the refcount when WebNode::toElement/toConstElement are called.
https://bugs.webkit.org/show_bug.cgi?id=33977

Ensures that when a wrapper around a WebNode is create via the
toElement() or toConstElement() calls that the refcount on the WebNode
is increased, by forcing a call to WebNode::assign(). This is needed
so that the following code:
{

WebNode n = someNode();
WebElement e = n.toElement<WebElement>();

}
does not decrease the overall refcount on the Node that someNode()
returns.

This caused crashes in the 'Save page as..' feature.

  • public/WebNode.h: (WebKit::WebNode::toElement): (WebKit::WebNode::toConstElement):
Location:
trunk/WebKit/chromium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r53671 r53678  
     12010-01-21  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Bumps the refcount when WebNode::toElement/toConstElement are called.
     6        https://bugs.webkit.org/show_bug.cgi?id=33977
     7       
     8        Ensures that when a wrapper around a WebNode is create via the
     9        toElement() or toConstElement() calls that the refcount on the WebNode
     10        is increased, by forcing a call to WebNode::assign().  This is needed
     11        so that the following code:
     12        {
     13          WebNode n = someNode();
     14          WebElement e = n.toElement<WebElement>();
     15        }
     16        does not decrease the overall refcount on the Node that someNode()
     17        returns.
     18
     19        This caused crashes in the 'Save page as..' feature.
     20
     21        * public/WebNode.h:
     22        (WebKit::WebNode::toElement):
     23        (WebKit::WebNode::toConstElement):
     24
    1252010-01-21  Michael Nordman  <michaeln@google.com>
    226
  • trunk/WebKit/chromium/public/WebNode.h

    r52774 r53678  
    105105    {
    106106        T res;
    107         res.m_private = m_private;
     107        res.WebNode::assign(*this);
    108108        return res;
    109109    }
     
    112112    {
    113113        T res;
    114         res.m_private = m_private;
     114        res.WebNode::assign(*this);
    115115        return res;
    116116    }
Note: See TracChangeset for help on using the changeset viewer.