<?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>135024</bug_id>
          
          <creation_ts>2014-07-17 14:03:22 -0700</creation_ts>
          <short_desc>willMoveToWebPage should be called with a null WebPage on WebPage teardown.</short_desc>
          <delta_ts>2014-07-17 14:15:11 -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>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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="Brady Eidson">beidson</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>thorton</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1023091</commentid>
    <comment_count>0</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2014-07-17 14:03:22 -0700</bug_when>
    <thetext>willMoveToWebPage should be called with a null WebPage on WebPage teardown.

Instead the PageOverlayController is just destroyed, which just destroys each overlay, and never notifies the PageOverlay::clients

Here&apos;s a backtrace of what happens today to destroy a PageOverlay, and the willMoveToWebPage should&apos;ve been called before that:

#0	0x0000000114dcf0e0 in WebKit::PageOverlay::~PageOverlay() at /Volumes/Data/git/OpenSource/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp:64
#1	0x0000000114f552af in -[WKObject dealloc] at /Volumes/Data/git/OpenSource/Source/WebKit2/Shared/Cocoa/WKObject.mm:40
#2	0x00007fff8225768c in objc_object::sidetable_release(bool) ()
#3	0x000000011529ff64 in API::Object::deref() at /Volumes/Data/git/OpenSource/Source/WebKit2/Shared/Cocoa/APIObject.mm:67
#4	0x0000000114b33d0b in void WTF::derefIfNotNull&lt;WebKit::PageOverlay&gt;(WebKit::PageOverlay*) at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/PassRefPtr.h:39
#5	0x0000000114b33cc8 in WTF::RefPtr&lt;WebKit::PageOverlay&gt;::~RefPtr() at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/RefPtr.h:55
#6	0x0000000114b2f265 in WTF::RefPtr&lt;WebKit::PageOverlay&gt;::~RefPtr() at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/RefPtr.h:55
#7	0x000000011503049f in WTF::VectorDestructor&lt;true, WTF::RefPtr&lt;WebKit::PageOverlay&gt; &gt;::destruct(WTF::RefPtr&lt;WebKit::PageOverlay&gt;*, WTF::RefPtr&lt;WebKit::PageOverlay&gt;*) at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/Vector.h:56
#8	0x000000011503045d in WTF::VectorTypeOperations&lt;WTF::RefPtr&lt;WebKit::PageOverlay&gt; &gt;::destruct(WTF::RefPtr&lt;WebKit::PageOverlay&gt;*, WTF::RefPtr&lt;WebKit::PageOverlay&gt;*) at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/Vector.h:220
#9	0x00000001150303c0 in WTF::Vector&lt;WTF::RefPtr&lt;WebKit::PageOverlay&gt;, 0ul, WTF::CrashOnOverflow&gt;::shrink(unsigned long) at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/Vector.h:957
#10	0x0000000115030324 in WTF::Vector&lt;WTF::RefPtr&lt;WebKit::PageOverlay&gt;, 0ul, WTF::CrashOnOverflow&gt;::~Vector() at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/Vector.h:596
#11	0x0000000115030165 in WTF::Vector&lt;WTF::RefPtr&lt;WebKit::PageOverlay&gt;, 0ul, WTF::CrashOnOverflow&gt;::~Vector() at /Volumes/Data/MyUser/build/Debug/usr/local/include/wtf/Vector.h:594
#12	0x000000011502ff61 in WebKit::PageOverlayController::~PageOverlayController() at /Volumes/Data/git/OpenSource/Source/WebKit2/WebProcess/WebPage/PageOverlayController.h:45
#13	0x000000011502c625 in WebKit::PageOverlayController::~PageOverlayController() at /Volumes/Data/git/OpenSource/Source/WebKit2/WebProcess/WebPage/PageOverlayController.h:45
#14	0x00000001150dd98b in WebKit::WebPage::~WebPage() at /Volumes/Data/git/OpenSource/Source/WebKit2/WebProcess/WebPage/WebPage.cpp:529
#15	0x00000001150de395 in WebKit::WebPage::~WebPage() at /Volumes/Data/git/OpenSource/Source/WebKit2/WebProcess/WebPage/WebPage.cpp:489</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023095</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Horton">thorton</who>
    <bug_when>2014-07-17 14:07:24 -0700</bug_when>
    <thetext>This is pretty bad because there&apos;s no guarantee that PageOverlay clients don&apos;t outlive the page, and then they&apos;ll have dangling PageOverlay pointers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1023098</commentid>
    <comment_count>2</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2014-07-17 14:15:11 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; This is pretty bad because there&apos;s no guarantee that PageOverlay clients don&apos;t outlive the page, and then they&apos;ll have dangling PageOverlay pointers.

Yup.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>