-
Notifications
You must be signed in to change notification settings - Fork 39
fontique: Fix panic on macOS in debug mode. #335
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
Conversation
This commit fixes a panic on macOS by enabling the "relax-sign-encoding" feature for the "objc2" crate. Relevant issues in the objc2 crate: madsmtm/objc2#566 madsmtm/objc2#567
See the commit below, for why we need the objc2 crate.
Could you document the issue a bit more? I can't reproduce ( |
From what I understand after reading this issue: madsmtm/objc2#566, Swift tries to use NSInteger instead of NSUInteger for Here is a link to the obj-c docs https://developer.apple.com/documentation/foundation/nsfastenumeration/countbyenumerating(with:objects:count:)?language=objc and the FFI binding function is listed below: The panic is happening because of this line which likely interprets the function's return type as a signed integer: You can ultimately track down this panic to this verification error, which is getting back a LongLong instead of the expected ULongLong. I'm not too sure why this error doesn't persist on your side as I'm also running Sequoia 15.4. Notes:
|
One more important piece of information that I just discovered is that this only happens in debug mode, release mode works fine. The objc2 library is most likely not checking the method signature in release mode and that is why it works in the release build. |
FWIW, I just ran into this as well. I started getting the error:
from I'm not sure what changed to trigger it, but searching for the error lead me to this 13 hour old PR, which seems like quite a coincidence. I'm on an M3 MacBook Air. Edit: Thinking about it, I did update MacOS to 15.4 at the start of the week, and this is perhaps the first time I've run the tests locally since then. The tests run in debug mode, whereas I run the application itself in release mode which seems unaffected as @NoahR02 mentioned. |
Ah, that'd do it. I rarely run in debug mode. |
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.
This works, but we want to check that this is still the best known solution.
The first image below shows the code panics when it goes into the objc2_foundation library / when we loop through the I searched their issues and pull requests and it seems like the |
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.
Thank you for your submission, and your research on the topic.
Feel free to merge.
This commit fixes a panic on macOS by enabling the "relax-sign-encoding" feature for the "objc2" crate.
Relevant issues in the objc2 crate:
madsmtm/objc2#566
madsmtm/objc2#567
I made sure to use version of objc2 that the current objc2-* variations use, so that we don't duplicate the crate.

Additional Info:
System Info: Mac Mini M4, 16 GB of RAM.
Before the fix, when running the vello-editor or any example:

After the fix:
