Assertions or crashes under _takeViewSnapshot when restoring windows
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / mac / WKView.mm
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));