Title: [198250] branches/safari-601.1.46-branch/Source/WebKit2
Revision
198250
Author
matthew_han...@apple.com
Date
2016-03-15 17:22:14 -0700 (Tue, 15 Mar 2016)

Log Message

Merge r195982. rdar://problem/24560759

Modified Paths

Diff

Modified: branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog (198249 => 198250)


--- branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2016-03-16 00:22:12 UTC (rev 198249)
+++ branches/safari-601.1.46-branch/Source/WebKit2/ChangeLog	2016-03-16 00:22:14 UTC (rev 198250)
@@ -1,5 +1,29 @@
 2016-03-15  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r195982. rdar://problem/24560759
+
+    2016-02-01  Tim Horton  <timothy_hor...@apple.com>
+
+            Crash using WKPDFView, in -[UIPDFPageView showContent]
+            https://bugs.webkit.org/show_bug.cgi?id=153770
+            <rdar://problem/20157864>
+
+            Reviewed by Anders Carlsson.
+
+            When scrolling, we throw away UIPDFPageViews, but forget to unhook their delegates.
+            In some cases (also because their delegate is a raw pointer, not weak), they can call
+            back into a deleted WKPDFView, causing a crash.
+
+            * UIProcess/ios/WKPDFView.mm:
+            (detachViewForPage):
+            Add a helper to detach a page view, and unhook its delegates.
+
+            (-[WKPDFView _clearPages]):
+            (-[WKPDFView _revalidateViews]):
+            Make use of the new helper.
+
+2016-03-15  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r194060. rdar://problem/24560757
 
     2015-12-14  Tim Horton  <timothy_hor...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm (198249 => 198250)


--- branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2016-03-16 00:22:12 UTC (rev 198249)
+++ branches/safari-601.1.46-branch/Source/WebKit2/UIProcess/ios/WKPDFView.mm	2016-03-16 00:22:14 UTC (rev 198250)
@@ -153,13 +153,18 @@
     return [_pdfDocument CGDocument];
 }
 
+static void detachViewForPage(PDFPageInfo& page)
+{
+    [page.view removeFromSuperview];
+    [page.view setDelegate:nil];
+    [[page.view annotationController] setDelegate:nil];
+    page.view = nil;
+}
+
 - (void)_clearPages
 {
-    for (auto& page : _pages) {
-        [page.view removeFromSuperview];
-        [page.view setDelegate:nil];
-        [[page.view annotationController] setDelegate:nil];
-    }
+    for (auto& page : _pages)
+        detachViewForPage(page);
     
     _pages.clear();
 }
@@ -265,8 +270,7 @@
 
     for (auto& pageInfo : _pages) {
         if (!CGRectIntersectsRect(pageInfo.frame, targetRectWithOverdraw) && pageInfo.index != _currentFindPageIndex) {
-            [pageInfo.view removeFromSuperview];
-            pageInfo.view = nullptr;
+            detachViewForPage(pageInfo);
             continue;
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to