Bug 48549

Summary: [Qt] refcount assertion on WebPageProxy, when closing a window
Product: WebKit Reporter: zalan <zalan>
Component: WebKit2Assignee: zalan <zalan>
Severity: Normal CC: christian.webkit, commit-queue, darin, sam
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Description Flags
remove extra adoptref
sam: review-
retain WKPageRef none

Description zalan 2010-10-28 12:19:09 PDT
ASSERTION FAILED: m_refCount > 0
(../../../qtwebkit-webkit2-dev/JavaScriptCore/wtf/RefCounted.h:83 bool WTF::RefCountedBase::derefBase())
occurs when closing a window.
Apparently a ref is missing, when WebPageProxy is destroyed. I am still yet to check it out on Mac, but with Qt, it is easy to reproduce. 
It looks like, during the construction of a new page, we lose one ref in WebUIClient::createNewPage(), when we call adoptRef on the WebPageProxy object. I'm puzzled why this adoptRef is called (WebUIClient.cpp line#78), when we already call adoptRef on the object, when it is being created (WebPageProxy::create()). Looking at the 'new page' callback backtrace, I can't see where this extra (adopted) ref would come from.
When adoptRef() is removed, refcount goes back to normal and no assert on window.close().
Comment 1 zalan 2010-11-11 00:39:03 PST
Created attachment 73586 [details]
remove extra adoptref
Comment 2 Sam Weinig 2010-11-11 16:04:51 PST
Comment on attachment 73586 [details]
remove extra adoptref

The implementation of createNewPage should return a retained WKPageRef, so the existing code is correct.
Comment 3 Darin Adler 2010-11-11 16:34:02 PST
This is probably a bug in the test program, not WebKit2 itself.
Comment 4 zalan 2010-11-11 23:56:20 PST
ok, thanks for the clarification.
Comment 5 zalan 2010-11-19 06:12:39 PST
Created attachment 74380 [details]
retain WKPageRef
Comment 6 Andreas Kling 2010-11-19 15:00:58 PST
Comment on attachment 74380 [details]
retain WKPageRef

Comment 7 WebKit Commit Bot 2010-11-19 22:26:28 PST
The commit-queue encountered the following flaky tests while processing attachment 74380 [details]:


Please file bugs against the tests.  These tests were authored by kmccullough@apple.com, oliver@apple.com, and timothy@apple.com.  The commit-queue is continuing to process your patch.
Comment 8 WebKit Commit Bot 2010-11-19 22:29:23 PST
Comment on attachment 74380 [details]
retain WKPageRef

Clearing flags on attachment: 74380

Committed r72468: <http://trac.webkit.org/changeset/72468>
Comment 9 WebKit Commit Bot 2010-11-19 22:29:30 PST
All reviewed patches have been landed.  Closing bug.