NoCopyRendering experiment: Fix possible memory leak if image node rendering is canceled #trivial (#765)

* Fix memory leak if image node rendering is canceled

* Update comment
This commit is contained in:
Adlai Holler 2018-01-23 10:45:34 -08:00 committed by GitHub
parent 9b8a919a93
commit c3ae4474d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -522,10 +522,9 @@ static ASDN::StaticMutex& cacheLock = *new ASDN::StaticMutex;
key.didDisplayNodeContentWithRenderingContext(context, drawParameters); key.didDisplayNodeContentWithRenderingContext(context, drawParameters);
} }
// The following `UIGraphicsGetImageFromCurrentImageContext` call will commonly take more than 20ms on an // Check cancellation one last time before forming image.
// A5 processor. Check for cancellation before we call it.
if (isCancelled()) { if (isCancelled()) {
UIGraphicsEndImageContext(); ASGraphicsEndImageContext();
return nil; return nil;
} }

View File

@ -23,6 +23,9 @@
* *
* The API mirrors the UIGraphics API, with the exception that forming an image * The API mirrors the UIGraphics API, with the exception that forming an image
* ends the context as well. * ends the context as well.
*
* Note: You must not mix-and-match between ASGraphics* and UIGraphics* functions
* within the same drawing operation.
*/ */
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN