-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build errors and a crash in xcode 15 #2093
Conversation
Source/Details/ASGraphicsContext.mm
Outdated
@@ -121,7 +121,9 @@ NS_INLINE void ASConfigureExtendedRange(UIGraphicsImageRendererFormat *format) | |||
} | |||
|
|||
// Bad OS or experiment flag. Use UIGraphics* API. | |||
UIGraphicsBeginImageContextWithOptions(size, opaque, scale); | |||
if (size.width > 0 && size.height > 0) { | |||
UIGraphicsBeginImageContextWithOptions(size, opaque, scale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have an invalid size, I think we should exit early and return nil. Shortly after starting the image context we call UIGraphicsGetImageFromCurrentImageContext
and UIGraphicsEndImageContext
. I'm not sure what the behavior is if we end a graphics context without starting one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've switched to an early return
* 'master' of https://github.com/TextureGroup/Texture: Fix build errors and a crash in xcode 15 (TextureGroup#2093) [ASCellNodeVisibilityEvent] Add a new event when scrolling stops (TextureGroup#2084) Trying to get CI to work (TextureGroup#2085) fix typo: ASStackLayoutElement.h (TextureGroup#2067) Docs: Fix references of ASViewController/ASNavigationController (non-existent) to ASDKViewController/ASDKNavigationController (TextureGroup#2072) [ASTextKitRenderer] Adding locking when accessing the text renderer cache (TextureGroup#2075) Switch UITextWritingDirection to NSWritingDirection (TextureGroup#2071)
Is this code is also available in the released version that is 3.1.0, because we're unable to find it in 3.1.0 release. |
Is this issue happening only if the app is built using XCode 15? |
Fix build errors and a crash in xcode 15 (TextureGroup#2093)
Fixes build errors when trying to compile with xcode15.
It also fixes a crash happening on XCode15 when attempting to create a new image with either a height or width of 0 or less (UIGraphicsBeginImageContextWithOptions). This can happen when isCancelled returns true.