Bug 48323

Summary: [Qt] Assert in the tst_hybridPixmap::hybridPixmap() unit test.
Product: WebKit Reporter: Jocelyn Turcotte <jturcotte>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ademar, commit-queue, kenneth
Priority: P3 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Jocelyn Turcotte 2010-10-26 07:08:56 PDT
ASSERTION FAILED: !m_adoptionIsRequired
(../../../JavaScriptCore/wtf/RefCounted.h:37 void WTF::RefCountedBase::ref())
Comment 1 Jocelyn Turcotte 2010-10-26 07:13:59 PDT
Created attachment 71877 [details]
Patch
Comment 2 Andreas Kling 2010-10-26 07:31:06 PDT
Comment on attachment 71877 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=71877&action=review

> WebCore/bridge/qt/qt_pixmapruntime.cpp:358
> -    QtPixmapInstance* instance = new QtPixmapInstance(root, data);
> +    RefPtr<QtPixmapInstance> instance = adoptRef(new QtPixmapInstance(root, data));

What happens with the QtPixmapInstance after this function returns?
I'm asking because it was leaked previously, and createRuntimeObject() returns a member of the instance.
Comment 3 Kenneth Rohde Christiansen 2010-10-26 07:50:09 PDT
(In reply to comment #2)
> (From update of attachment 71877 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=71877&action=review
> 
> > WebCore/bridge/qt/qt_pixmapruntime.cpp:358
> > -    QtPixmapInstance* instance = new QtPixmapInstance(root, data);
> > +    RefPtr<QtPixmapInstance> instance = adoptRef(new QtPixmapInstance(root, data));
> 
> What happens with the QtPixmapInstance after this function returns?
> I'm asking because it was leaked previously, and createRuntimeObject() returns a member of the instance.

You are right, it will be dereffed on return. It depends on what createRuntimeObject is doing.
Comment 4 Kenneth Rohde Christiansen 2010-10-26 09:06:30 PDT
> > WebCore/bridge/qt/qt_pixmapruntime.cpp:358
> > -    QtPixmapInstance* instance = new QtPixmapInstance(root, data);
> > +    RefPtr<QtPixmapInstance> instance = adoptRef(new QtPixmapInstance(root, data));
> 
> What happens with the QtPixmapInstance after this function returns?
> I'm asking because it was leaked previously, and createRuntimeObject() returns a member of the instance.

That member which is being returned is created by newRuntimeObject, but not owner by the Instance.
Comment 5 WebKit Commit Bot 2010-10-26 12:47:58 PDT
Comment on attachment 71877 [details]
Patch

Clearing flags on attachment: 71877

Committed r70557: <http://trac.webkit.org/changeset/70557>
Comment 6 WebKit Commit Bot 2010-10-26 12:48:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Ademar Reis 2010-10-26 13:03:59 PDT
Revision r70557 cherry-picked into qtwebkit-2.1 with commit 12362e4 <http://gitorious.org/webkit/qtwebkit/commit/12362e4>