Skip to content
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

Persistent crash on launch when running in iOS 14.4 simulator on M1 Mac #4140

Closed
Johennes opened this issue Mar 24, 2021 · 0 comments · Fixed by matrix-org/matrix-ios-sdk#1054

Comments

@Johennes
Copy link
Contributor

Describe the bug

The app continuously crashes when trying to cache room avatars on launch in the iOS 14.4 simulator on an M1 Mac.

To Reproduce

  1. On an M1 Mac build and run in the app in an iOS 14.4 simulator
  2. Log into an account that has previously joined a room with an avatar (e.g. #element-ios:matrix.org)
  3. App crashes and continues to crash on every relaunch

Expected behavior

App does not crash.

Screenshots

Screenshot 2021-03-24 at 10 25 33

Smartphone (please complete the following information):

  • Device: iPhone 12 Pro Max simulator on an M1 Mac mini
  • OS: iOS14.4
  • Version: current develop branch

Additional context

The crash occurs in MXTools when calling CFRelease on a NULL pointer (which is documented behavior).

The NULL pointer is returned from UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType, NULL) and calling that function is accompanied with an error logged in the console:

Riot[39791:284076] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)" UserInfo={_LSFunction=_LSSchemaConfigureForStore, ExpectedSimulatorHash={length = 32, bytes = 0x4b64f053 8d1364ff 0b68dbfb 9e7f437e ... d8889279 df4097f1 }, _LSLine=405, WrongSimulatorHash={length = 32, bytes = 0x4b3fda1a 658aac51 e905a4b9 3f769913 ... 73e7d3c9 4a353cfc }}

This might be a simulator bug on the M1 (see e.g. here). Nevertheless, the return value should be checked to avoid releasing a null pointer.

Johennes added a commit to Johennes/matrix-ios-sdk that referenced this issue Mar 24, 2021
Due to a Simulator bug on the Apple M1, `UTTypeCreatePreferredIdentifierForTag` can
unexpectedly return `NULL`. This causes a crash because the return value is later
passed into `CFRelease` which explicitly disallows `NULL` arguments.

This commit fixes the issue by ensuring the return value is not `NULL` before
proceeding.

Fixes: element-hq/element-ios#4140

Signed-off-by: Johannes Marbach <[email protected]>
Johennes added a commit to Johennes/matrix-ios-sdk that referenced this issue Mar 24, 2021
Due to a Simulator bug on the Apple M1, `UTTypeCreatePreferredIdentifierForTag` can
unexpectedly return `NULL`. This causes a crash because the return value is later
passed into `CFRelease` which explicitly disallows `NULL` arguments.

This commit fixes the issue by ensuring the return value is not `NULL` before
proceeding.

Fixes: element-hq/element-ios#4140

Signed-off-by: Johannes Marbach <[email protected]>
@manuroe manuroe added this to the Sprint - Element 1.2.7 milestone Mar 24, 2021
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 a pull request may close this issue.

2 participants