<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>48549</bug_id>
          
          <creation_ts>2010-10-28 12:19:09 -0700</creation_ts>
          <short_desc>[Qt] refcount assertion on WebPageProxy, when closing a window</short_desc>
          <delta_ts>2010-11-19 22:29:30 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="alan">zalan</reporter>
          <assigned_to name="alan">zalan</assigned_to>
          <cc>christian.webkit</cc>
    
    <cc>commit-queue</cc>
    
    <cc>darin</cc>
    
    <cc>sam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>301227</commentid>
    <comment_count>0</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2010-10-28 12:19:09 -0700</bug_when>
    <thetext>ASSERTION FAILED: m_refCount &gt; 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&apos;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 &apos;new page&apos; callback backtrace, I can&apos;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().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>307768</commentid>
    <comment_count>1</comment_count>
      <attachid>73586</attachid>
    <who name="alan">zalan</who>
    <bug_when>2010-11-11 00:39:03 -0800</bug_when>
    <thetext>Created attachment 73586
remove extra adoptref</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>308242</commentid>
    <comment_count>2</comment_count>
      <attachid>73586</attachid>
    <who name="Sam Weinig">sam</who>
    <bug_when>2010-11-11 16:04:51 -0800</bug_when>
    <thetext>Comment on attachment 73586
remove extra adoptref

The implementation of createNewPage should return a retained WKPageRef, so the existing code is correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>308258</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-11-11 16:34:02 -0800</bug_when>
    <thetext>This is probably a bug in the test program, not WebKit2 itself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>308413</commentid>
    <comment_count>4</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2010-11-11 23:56:20 -0800</bug_when>
    <thetext>ok, thanks for the clarification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311406</commentid>
    <comment_count>5</comment_count>
      <attachid>74380</attachid>
    <who name="alan">zalan</who>
    <bug_when>2010-11-19 06:12:39 -0800</bug_when>
    <thetext>Created attachment 74380
retain WKPageRef</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311707</commentid>
    <comment_count>6</comment_count>
      <attachid>74380</attachid>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-11-19 15:00:58 -0800</bug_when>
    <thetext>Comment on attachment 74380
retain WKPageRef

LGTM</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311872</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-11-19 22:26:28 -0800</bug_when>
    <thetext>The commit-queue encountered the following flaky tests while processing attachment 74380:

fast/profiler/throw-exception-from-eval.html

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311873</commentid>
    <comment_count>8</comment_count>
      <attachid>74380</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-11-19 22:29:23 -0800</bug_when>
    <thetext>Comment on attachment 74380
retain WKPageRef

Clearing flags on attachment: 74380

Committed r72468: &lt;http://trac.webkit.org/changeset/72468&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>311874</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-11-19 22:29:30 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>73586</attachid>
            <date>2010-11-11 00:39:03 -0800</date>
            <delta_ts>2010-11-11 16:04:51 -0800</delta_ts>
            <desc>remove extra adoptref</desc>
            <filename>remove_adoptref.pathc</filename>
            <type>text/plain</type>
            <size>1316</size>
            <attacher name="alan">zalan</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdDIvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYktpdDIvQ2hhbmdlTG9n
CShyZXZpc2lvbiA3MTc5OSkKKysrIFdlYktpdDIvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMTEtMTEgIFphbGFuIEJ1anRhcyAgPHpidWp0YXNAZ21haWwu
Y29tPgorCis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YXR1cmVzTWFwLmdldCgpKSwgdG9BUEkobW9kaWZpZXJz
KSwgdG9BUEkoYnV0dG9uKSwgbV9jbGllbnQuY2xpZW50SW5mbykpKTsKKyAgICByZXR1cm4gdG9J
bXBsKG1fY2xpZW50LmNyZWF0ZU5ld1BhZ2UodG9BUEkocGFnZSksIHRvQVBJKGZlYXR1cmVzTWFw
LmdldCgpKSwgdG9BUEkobW9kaWZpZXJzKSwgdG9BUEkoYnV0dG9uKSwgbV9jbGllbnQuY2xpZW50
SW5mbykpOwogfSAKIAogdm9pZCBXZWJVSUNsaWVudDo6c2hvd1BhZ2UoV2ViUGFnZVByb3h5KiBw
YWdlKQo=
</data>
<flag name="review"
          id="64042"
          type_id="1"
          status="-"
          setter="sam"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>74380</attachid>
            <date>2010-11-19 06:12:39 -0800</date>
            <delta_ts>2010-11-19 22:29:23 -0800</delta_ts>
            <desc>retain WKPageRef</desc>
            <filename>retain.patch</filename>
            <type>text/plain</type>
            <size>1252</size>
            <attacher name="alan">zalan</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdDIvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYktpdDIvQ2hhbmdlTG9n
CShyZXZpc2lvbiA3MjM4NykKKysrIFdlYktpdDIvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMTEtMTkgIFphbGFuIEJ1anRhcyAgPHpidWp0YXNAZ21haWwu
Y29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFdl
YlVJQ2xpZW50OjpjcmVhdGVOZXdQYWdlKCkgZXhwZWN0cyBhIHJldGFpbmVkIFdLUGFnZVJlZi4g
CisgICAgICAgIGh0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