[iOS device] Crash when attempting to call -[_WKAttachment info] for an editable...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Dec 2018 09:05:45 +0000 (09:05 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Dec 2018 09:05:45 +0000 (09:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192538

Reviewed by Tim Horton.

Fix the crash by ensuring that the result of `-renderedDrawing` survives long enough to be wrapped by a
`RetainPtr` in `-PNGRepresentation`. This isn't currently testable, since this codepath isn't supported on the
iOS simulator; instead, I manually verified using MobileAttachments.app.

* UIProcess/ios/WKDrawingView.mm:
(-[WKDrawingView renderedDrawing]):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKDrawingView.mm

index 2512333..296fac9 100644 (file)
@@ -1,3 +1,17 @@
+2018-12-09  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        [iOS device] Crash when attempting to call -[_WKAttachment info] for an editable image
+        https://bugs.webkit.org/show_bug.cgi?id=192538
+
+        Reviewed by Tim Horton.
+
+        Fix the crash by ensuring that the result of `-renderedDrawing` survives long enough to be wrapped by a
+        `RetainPtr` in `-PNGRepresentation`. This isn't currently testable, since this codepath isn't supported on the
+        iOS simulator; instead, I manually verified using MobileAttachments.app.
+
+        * UIProcess/ios/WKDrawingView.mm:
+        (-[WKDrawingView renderedDrawing]):
+
 2018-12-09  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r239010.
index d0d903d..d914b8c 100644 (file)
@@ -120,7 +120,7 @@ static UIImage *emptyImage()
     // an NSFileWrapper to be available synchronously.
     dispatch_sync(_renderQueue.get(), ^{ });
 
-    return resultImage.get();
+    return resultImage.autorelease();
 #endif
 }