[Webkit-unassigned] [Bug 19898] [Gtk] WebKitWebHistoryItem: Fixes and improvements

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 27 16:05:49 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=19898


eric at webkit.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22504|review?                     |review-
               Flag|                            |




------- Comment #11 from eric at webkit.org  2008-08-27 16:05 PDT -------
(From update of attachment 22504)
This just leads to unsafe access:
 53     WTF::RefPtr<WebCore::HistoryItem> core(WebKitWebHistoryItem*);


Returning a RefPtr is bad-news.  You end up churning the ref-count (the
temporary RefPtr used for the return increments the ref count only to
immediately decrement it again when it's destroyed).  Also things like this end
up being wrong:

core(item).get()

If someone holds onto that pointer, it could have already gone away!   Cause
the temporary RefPtr returned from core() could have been the only thing
holding on to it.

If you already have a RefPtr, you should return:
const RefPtr& which is safe, although really not any better than Class*

PassRefPtr is how we return or pass ref counted objects.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list