Signal-iOS
Signal-iOS copied to clipboard
Fix for constraint SafeArea loop crash.
First time contributor checklist
- [x] I have read the README and CONTRIBUTING documents
- [x] I have signed the Contributor Licence Agreement
Contributor checklist
- [x] My commits are rebased on the latest main branch
- [x] My commits are in nice logical chunks
- [x] My contribution is fully baked and is ready to be merged as is
- [x] 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)
- Rotate the device to be in landscape
- Compose a new message from the Chat Tab
- Tap New Group
- Tap Skip
- Enter a name for the group (The name does not matter)
- Tap Create
- 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.
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.