Repository navigation
Conversation
main() keeps CClient and CServer on the stack. On x86-64 and aarch64 that reserves roughly 341 KB of stack for main(), almost all of it CServer (~336 KB); CClient adds ~9 KB. iOS gives the main thread a 1 MB stack, and the deep UIKit startup stack can overflow that, corrupting Qt state. Allocate both objects with std::unique_ptr instead. Lifetime and destruction order are unchanged, and the call sites keep using raw pointers via .get(). Refs jamulussoftware#3808
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| // Allocate the client on the heap: it is too large for the main | ||
| // thread stack on iOS (1 MB), where the deep UIKit startup stack | ||
| // can otherwise overflow and corrupt Qt's state. |
There was a problem hiding this comment.
May want to shorten this...
|
Part of the Qt 6 iOS set with #3988 and #3989. This is not what blocked iOS from starting: the launch abort was the UIScene lifecycle issue addressed in #3988, and with that change alone the release tag launches and renders. This one removes a ~341 KB stack frame against iOS's 1 MB main thread stack, which is where the startup crash in #3808 was suspected. Together with #3988 and #3989, the set is what allows an iOS release on Qt 6 (3.12.6 or 3.12.7, maintainers' call).
|
|
Built and ran with this change on an iPhone 15 Pro (iOS 27.0.1) and in the iPhone 17, iPad Pro and Apple Vision Pro simulators. It is not what blocked the iOS launch - that was the UIScene lifecycle issue addressed in #3988 - so this is not required for a 3.12.6/3.12.7 iOS build.
|
|
Low priority. |
Short description of changes
Allocate
CClientandCServerwithstd::unique_ptrinmain()instead of keeping them on the stack.main()'s frame is sized for the larger of the two mutually exclusive branches, so it reserves roughly 341 KB of stack (aarch64 and x86-64 alike), of whichCServeris ~336 KB andCClient~9 KB. iOS gives the main thread a 1 MB stack, and the deep UIKit startup stack can overflow that. Stack corruption of that kind can hit anything that lives nearby, including Qt's own state.Lifetime and destruction order are unchanged: the objects are still created and destroyed in the same scope, and call sites keep taking raw pointers via
.get().CClientSettings,CServerSettings,CClientDlgandCServerDlgare left on the stack — they are small (hundreds of bytes) and not the reason for the frame size.CClientRpc/CServerRpcare also left alone: they are already parented topRpcServer, so aunique_ptrwould double-free.CHANGELOG: SKIP
Context: Fixes an issue?
Refs #3808 (upstream). It does not claim to close it: with the two Qt/iOS startup issues fixed separately — ann0see#341 (a fork-only PR, not yet submitted upstream) and the UIScene setup — I could not reproduce the original crash with or without this change.
Does this change need documentation? What needs to be documented and how?
No.
Status of this Pull Request
Working implementation, verified locally.
What is missing until this pull request can be merged?
Checklist
AUTOBUILD: Please build all targets