Skip to content

Fix Ventura Crash #3

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

Merged
merged 1 commit into from
Jun 16, 2022
Merged

Fix Ventura Crash #3

merged 1 commit into from
Jun 16, 2022

Conversation

alokedesai
Copy link
Member

Fixes WAR-3757

At a high level the issue that's causing this crash is that reading from the font traits CFDictionary in Core Text doesn't always return a value that matches the CFNumber CFTypeID (it returns a CFBoolean that is always false instead).

Confirmed in vanilla Objective-C the exact same behavior. As a simple fix, try to downcast into a CFBoolean if downcasting into a CFNumber fails and then recreate a CFNumber from that CFBoolean.

Verified locally that Warp fully works on Ventura--I've used it as my day to day terminal for the past day with no issues.,

Note will also try to fix this upstream and merge the two versions of core-foundation-rs as a followup

@linear
Copy link

linear bot commented Jun 16, 2022

@alokedesai alokedesai requested a review from vorporeal June 16, 2022 21:27
Copy link

@vorporeal vorporeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM; curious if you think there will be any performance implications here. (Not sure how often we check font traits.)

@alokedesai
Copy link
Member Author

Code LGTM; curious if you think there will be any performance implications here. (Not sure how often we check font traits.)

As far as I can tell this only happens for a few symbol fonts (the 3 I've identified are "Apple Symbols", "Gujarati Sangam MN", "Myanmar Sangam MN").

Additionally, if we aren't actively rendering this font, we only call the traits when attempting to load the font on app startup.

If we are actually rendering the font (either the font dropdown is open or the user has chosen one of these wonky fonts as their terminal font) we'll make a call on every render but. even then, I wouldn't expect the additional downcast from CFType to CFBoolean to have a meaningful impact on performance.

Given the fact the app is just completely crashing on Ventura right now and that the added lines of code are only going to run when the app would have otherwise panicked, I think this is a reasonable tradeoff. That being said, I agree we should monitor this and understand if there is a meaningful change in performance between users on Ventura and previous OS versions (Doing a 1:1 comparison is a little tricky because I don't have metrics of using Warp pre-Ventura on the computer I'm using for testing. Using Profiler, the total weight of extract_number_for_key when I make one of these symbols my font and then scroll repeatedly is still 0.0%)

@alokedesai alokedesai merged commit 3775965 into master Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants