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

Fix for constraint SafeArea loop crash. #5703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnsonajason
Copy link

First time contributor checklist

Contributor checklist

  • My commits are rebased on the latest main branch
  • My commits are in nice logical chunks
  • My contribution is fully baked and is ready to be merged as is
  • I have tested my contribution on these devices:
  • iPhone 15 Pro, iOS 17.0
  • iPhone 15 Pro Max, iOS 17.0
  • iPhone 15 SE, iOS 17.0

Description

This is to fix a crash that occurs on specific devices in landscape. There was an edge case issue with constraints and safeArea causing the views layout to loop and eventually crash.

Steps to reproduce the crash:

  • Use iOS 16.6.1 or 17.0 (I did not test other versions).
  • Use a Max device (ex. iPhone 12 Pro Max or iPhone 15 Pro Max)
  1. Rotate the device to be in landscape
  2. Compose a new message from the Chat Tab
  3. Tap New Group
  4. Tap Skip
  5. Enter a name for the group (The name does not matter)
  6. Tap Create
  7. Tap "Enable and Share Link"

The share sheet will not present and memory will constantly grow. The app will eventually crash.

To Verify the reason for the crash you can add -UIViewLayoutFeedbackLoopDebuggingThreshold 50 to the apps run arguments and set an all exceptions breakpoint with the following action po [_UIViewLayoutFeedbackLoopDebugger layoutFeedbackLoopDebugger]

Issue:
The constraints on the actionSheets scrollView subviews would adjust to to avoid the safeArea, this in turn would resize the scrollview. In most cases this works correctly but if the size of the subview was within a small range of the maximum scrollView size a constraint loop would occur where resizing the scrollView would relayout the subviews which would no longer be affected by the safeArea causing the scrollView to resize again. This would continue to infinitely resize these views in a layout loop.

Solution:
To solve this issue I moved the handling of the safeArea to the scrollView and altered a few layout parameters to compensate for this change.

@Miguel-Signal
Copy link

Hi @johnsonajason, thanks for bringing this crash to our attention.

I've gone ahead and filed this with our engineering team. While our engineers are working on a fix, I unfortunately can't give out a specific timeline for a resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants