Assertions or crashes under _takeViewSnapshot when restoring windows
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jul 2014 15:39:49 +0000 (15:39 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jul 2014 15:39:49 +0000 (15:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134792

Reviewed by Simon Fraser.

* UIProcess/API/mac/WKView.mm:
(-[WKView _takeViewSnapshot]):
Taking a window-server snapshot of a non-visible window tends to not succeed.

* platform/graphics/cocoa/IOSurface.mm:
(IOSurface::createFromImage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170963 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cocoa/IOSurface.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/WKView.mm

index 14b9fe6c6175ed05a6025ad04e3b6bc4fe48401e..f640b12082006b1bcbe4743882686a9a7e7a4b6c 100644 (file)
@@ -1,3 +1,13 @@
+2014-07-10  Timothy Horton  <timothy_horton@apple.com>
+
+        Assertions or crashes under _takeViewSnapshot when restoring windows
+        https://bugs.webkit.org/show_bug.cgi?id=134792
+
+        Reviewed by Simon Fraser.
+
+        * platform/graphics/cocoa/IOSurface.mm:
+        (IOSurface::createFromImage):
+
 2014-07-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         [XHR] overrideMimeType() should be able to change encoding in HEADERS RECEIVED state
index b72f3bd1538de1bb23831f3268dd51475984541f..4d85a6185d04550ec8e27c31bb5e83a7d9beac8b 100644 (file)
@@ -72,6 +72,9 @@ PassRefPtr<IOSurface> IOSurface::createFromSurface(IOSurfaceRef surface, ColorSp
 
 PassRefPtr<IOSurface> IOSurface::createFromImage(CGImageRef image)
 {
+    if (!image)
+        return nullptr;
+
     size_t width = CGImageGetWidth(image);
     size_t height = CGImageGetHeight(image);
 
index 88fc477ac5cb0c38ca262fe4a731744919ea5ac6..547d73c8a44df8a24306ca09d5766bf8100cc52d 100644 (file)
@@ -1,3 +1,14 @@
+2014-07-10  Timothy Horton  <timothy_horton@apple.com>
+
+        Assertions or crashes under _takeViewSnapshot when restoring windows
+        https://bugs.webkit.org/show_bug.cgi?id=134792
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _takeViewSnapshot]):
+        Taking a window-server snapshot of a non-visible window tends to not succeed.
+
 2014-07-09  Pratik Solanki  <psolanki@apple.com>
 
         Buffer CSS and JS resources in network process before sending over to web process
index e578a07968b3ce0f1398894551c1eb3405bbda27..11dd71135f16e7c2537521b446ff4d2123e8fabb 100644 (file)
@@ -3108,7 +3108,7 @@ static void* keyValueObservingContext = &keyValueObservingContext;
     ViewSnapshot snapshot;
 
     CGSWindowID windowID = (CGSWindowID)[window windowNumber];
-    if (!windowID)
+    if (!windowID || ![window isVisible])
         return snapshot;
 
     RetainPtr<CGImageRef> windowSnapshotImage = adoptCF(CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque));