Title: [183588] trunk/Source/WebKit2
Revision
183588
Author
[email protected]
Date
2015-04-29 16:19:00 -0700 (Wed, 29 Apr 2015)

Log Message

UI process sometimes crashes under _takeViewSnapshot when the window is off-screen
https://bugs.webkit.org/show_bug.cgi?id=144418
<rdar://problem/20740278>

Reviewed by Alexey Proskuryakov.

* UIProcess/API/mac/WKView.mm:
(-[WKView _takeViewSnapshot]):
Null-check the array before checking if it has any items.
If the window is off-screen, we can't snapshot it.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (183587 => 183588)


--- trunk/Source/WebKit2/ChangeLog	2015-04-29 23:03:40 UTC (rev 183587)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-29 23:19:00 UTC (rev 183588)
@@ -1,3 +1,16 @@
+2015-04-29  Tim Horton  <[email protected]>
+
+        UI process sometimes crashes under _takeViewSnapshot when the window is off-screen
+        https://bugs.webkit.org/show_bug.cgi?id=144418
+        <rdar://problem/20740278>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _takeViewSnapshot]):
+        Null-check the array before checking if it has any items.
+        If the window is off-screen, we can't snapshot it.
+
 2015-04-29  Simon Fraser  <[email protected]>
 
         Allow testing of plug-ins that handle wheel events.

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (183587 => 183588)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-04-29 23:03:40 UTC (rev 183587)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2015-04-29 23:19:00 UTC (rev 183588)
@@ -3379,7 +3379,7 @@
 
     CGSWindowCaptureOptions options = kCGSCaptureIgnoreGlobalClipShape;
     RetainPtr<CFArrayRef> windowSnapshotImages = adoptCF(CGSHWCaptureWindowList(CGSMainConnectionID(), &windowID, 1, options));
-    if (!CFArrayGetCount(windowSnapshotImages.get()))
+    if (!windowSnapshotImages || !CFArrayGetCount(windowSnapshotImages.get()))
         return nullptr;
 
     RetainPtr<CGImageRef> windowSnapshotImage = (CGImageRef)CFArrayGetValueAtIndex(windowSnapshotImages.get(), 0);
@@ -3389,7 +3389,7 @@
     if (CGImageGetWidth(windowSnapshotImage.get()) != desiredSnapshotWidth) {
         options |= kCGSWindowCaptureNominalResolution;
         windowSnapshotImages = adoptCF(CGSHWCaptureWindowList(CGSMainConnectionID(), &windowID, 1, options));
-        if (!CFArrayGetCount(windowSnapshotImages.get()))
+        if (!windowSnapshotImages || !CFArrayGetCount(windowSnapshotImages.get()))
             return nullptr;
         windowSnapshotImage = (CGImageRef)CFArrayGetValueAtIndex(windowSnapshotImages.get(), 0);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to