Bug 33977 - [Chromium] WebNode::toElement refcounts incorrectly
Summary: [Chromium] WebNode::toElement refcounts incorrectly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-21 16:04 PST by James Robinson
Modified: 2010-01-21 22:22 PST (History)
3 users (show)

See Also:


Attachments
Fixes the bug by using WebNode::assign() (1.68 KB, patch)
2010-01-21 16:07 PST, James Robinson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Robinson 2010-01-21 16:04:30 PST
The following results in the refcount on 'foo' decreasing by one, when it should stay the same:

{
  WebNode n = foo;
  WebElement e = n.toElement<WebElement>();
}

This is because WebNode::toElement() does not increment the refcount on 'foo', but the WebElement destructor does decrement the refcount.
Comment 1 James Robinson 2010-01-21 16:07:57 PST
Created attachment 47155 [details]
Fixes the bug by using WebNode::assign()

I have to use the WebNode:: qualifier because some T's that are used in this function (like WebElement) define incompatible 1-arg versions of ::assign(), for example WebElement::assign(const WebElement& e).  This confuses visual studio terribly.  I'm not sure if this is an issue with the compiler, but we always want to use the WebNode::assign() version anyway.
Comment 2 WebKit Commit Bot 2010-01-21 22:22:00 PST
Comment on attachment 47155 [details]
Fixes the bug by using WebNode::assign()

Clearing flags on attachment: 47155

Committed r53678: <http://trac.webkit.org/changeset/53678>
Comment 3 WebKit Commit Bot 2010-01-21 22:22:07 PST
All reviewed patches have been landed.  Closing bug.