<?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>41877</bug_id>
          
          <creation_ts>2010-07-08 11:17:45 -0700</creation_ts>
          <short_desc>Notify browser about popup being deleted</short_desc>
          <delta_ts>2010-07-14 07:10:43 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lucas De Marchi">lucas.de.marchi</reporter>
          <assigned_to name="Lucas De Marchi">lucas.de.marchi</assigned_to>
          <cc>barbieri</cc>
    
    <cc>commit-queue</cc>
    
    <cc>luiz</cc>
    
    <cc>tkent</cc>
    
    <cc>tonikitoo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>248355</commentid>
    <comment_count>0</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2010-07-08 11:17:45 -0700</bug_when>
    <thetext>Notify browser about popup being deleted</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>248366</commentid>
    <comment_count>1</comment_count>
      <attachid>60916</attachid>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2010-07-08 11:29:08 -0700</bug_when>
    <thetext>Created attachment 60916
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>248369</commentid>
    <comment_count>2</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2010-07-08 11:32:45 -0700</bug_when>
    <thetext>Kent, I added you to CC since you reviewed the BREW implementation on bug 40226. It also applies for you, so I fixed your file too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>248376</commentid>
    <comment_count>3</comment_count>
      <attachid>60916</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2010-07-08 11:36:05 -0700</bug_when>
    <thetext>Comment on attachment 60916
Patch

Generally speaking it&apos;s not good to do any work from the destructor of a reference-counted object. Because the timing of the destructor can be affected by someone taking a reference to the object. We normally avoid that pattern and do work at some well-defined time other than object destruction.

Can we do that here? Code that does anything except for deallocating memory and clearing out back pointers and such in the destructor of a reference counted object causes long term maintainability problems that I think we would be better off without.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>248386</commentid>
    <comment_count>4</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2010-07-08 11:46:27 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (From update of attachment 60916 [details])
&gt; Can we do that here? Code that does anything except for deallocating memory and clearing out back pointers and such in the destructor of a reference counted object causes long term maintainability problems that I think we would be better off without.

Darin, this will in fact deallocate m_popup that would remain alive otherwise. It&apos;s more or less what QT and GTK do, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>249731</commentid>
    <comment_count>5</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2010-07-12 02:50:20 -0700</bug_when>
    <thetext>&gt; diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
&gt; index 041e2e3c5e2edcf993c89a756f5ff2564a0324d7..c3bb6ad6eb3ccb8bc3a2049334eaf208b42861a0 100644
&gt; --- a/WebCore/ChangeLog
&gt; +++ b/WebCore/ChangeLog
&gt; @@ -1,3 +1,24 @@
&gt; +2010-07-08  Lucas De Marchi  &lt;lucas.demarchi@profusion.mobi&gt;
&gt; +
&gt; +        Reviewed by NOBODY (OOPS!).
&gt; +
&gt; +        Notify browser about popup being deleted. In EFL and BREW ports, the
&gt; +        WebCore::Popup object was being deleted leaving the popup in browser
&gt; +        alive. Popups can be deleted in two ways: either from browser to webcore or
&gt; +        from webcore to browser. The first path was ok. The problem was when the
&gt; +        user changed the page with a popup still opened. This would trigger the
&gt; +        second path and would cause WebCore::Popup to be deleted without
&gt; +        notifying browser.

If we need to delete a popup when the browser navigates to another page, we had better call hide() when the page is unloaded, not ~PopupMenu().  If it&apos;s hard to do so, the current code is ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>249805</commentid>
    <comment_count>6</comment_count>
    <who name="Antonio Gomes">tonikitoo</who>
    <bug_when>2010-07-12 06:54:06 -0700</bug_when>
    <thetext>Luiz, how are we dealing with that on Qt?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>250822</commentid>
    <comment_count>7</comment_count>
    <who name="Lucas De Marchi">lucas.de.marchi</who>
    <bug_when>2010-07-13 16:57:40 -0700</bug_when>
    <thetext>This patch is only notifying the C counterpart of the API to give it a chance to free the platform data. This API happens to notify the browser, since it doesn&apos;t maintain the respective widget, and then disconnects itself.

I thought QT was using a similar approach, but I couldn&apos;t find where the popup would be deleted by WebCore. It&apos;s the same of GTK, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>251168</commentid>
    <comment_count>8</comment_count>
      <attachid>60916</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-07-14 07:10:39 -0700</bug_when>
    <thetext>Comment on attachment 60916
Patch

Clearing flags on attachment: 60916

Committed r63316: &lt;http://trac.webkit.org/changeset/63316&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>251169</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2010-07-14 07:10:43 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>60916</attachid>
            <date>2010-07-08 11:29:08 -0700</date>
            <delta_ts>2010-07-14 07:10:38 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-41877-20100708153000.patch</filename>
            <type>text/plain</type>
            <size>2363</size>
            <attacher name="Lucas De Marchi">lucas.de.marchi</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
MDQxZTJlM2M1ZTJlZGNmOTkzYzg5YTc1NmY1ZmYyNTY0YTAzMjRkNy4uYzNiYjZhZDZlYjNjY2I4
YmMzYTIwNDkzMzRlYWYyMDhiNDI4NjFhMCAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cK
KysrIGIvV2ViQ29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwyNCBAQAorMjAxMC0wNy0wOCAgTHVj
YXMgRGUgTWFyY2hpICA8bHVjYXMuZGVtYXJjaGlAcHJvZnVzaW9uLm1vYmk+CisKKyAgICAgICAg
UmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgTm90aWZ5IGJyb3dzZXIgYWJv
dXQgcG9wdXAgYmVpbmcgZGVsZXRlZC4gSW4gRUZMIGFuZCBCUkVXIHBvcnRzLCB0aGUKKyAgICAg
ICAgV2ViQ29yZTo6UG9wdXAgb2JqZWN0IHdhcyBiZWluZyBkZWxldGVkIGxlYXZpbmcgdGhlIHBv
cHVwIGluIGJyb3dzZXIKKyAgICAgICAgYWxpdmUuIFBvcHVwcyBjYW4gYmUgZGVsZXRlZCBpbiB0
d28gd2F5czogZWl0aGVyIGZyb20gYnJvd3NlciB0byB3ZWJjb3JlIG9yCisgICAgICAgIGZyb20g
d2ViY29yZSB0byBicm93c2VyLiBUaGUgZmlyc3QgcGF0aCB3YXMgb2suIFRoZSBwcm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