When I enable resizing of app window in our macOS app, (new?) users get a crash at launch that I can't reproduce. On removing this code, the crashes stop. Symbolicated report below (crashed thread only). Any help appreciated:
Crashed Thread: 0
Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
** Terminating app due to uncaught exception'NSGenericException', reason: 'The window has been marked as needing another Layout Window pass, but it has already had more Layout Window passes than there are views in the window.'
terminating with uncaught exception of type NSException
abort() called
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff35ab1727 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff6ea17a9e objc_exception_throw + 48
2 CoreFoundation 0x00007fff35ab1585 +[NSException
raise:format:] + 181
3 AppKit 0x00007fff32ce198b -[NSWindow(NSDisplayCycle)
_postWindowNeedsLayoutUnlessPostingDisabled] + 1577
4 AppKit 0x00007fff32ce1307 -[NSWindow(NSConstraintBasedLayout)
_setViewsNeedLayout:] + 49
5 AppKit 0x00007fff32cb6a5b[NSView setNeedsLayout:] + 660
6 UIFoundation 0x00007fff66b3305a -[_NSCollectionViewCore
setNeedsLayout] + 53
7 UIFoundation 0x00007fff66b32a9a -[_NSCollectionViewCore
_invalidateLayoutWithContext:] + 3473
8 UIFoundation 0x00007fff66b31ce5 -[NSCollectionViewLayout
invalidateLayoutWithContext:] + 79
9 UIFoundation 0x00007fff66b31ae7[NSCollectionViewFlowLayout invalidateLayoutWithContext:] + 1901
10 UIFoundation 0x00007fff66b31367 -[NSCollectionViewLayout
invalidateLayout] + 129
11 APTX 0x000000010f6062d3
HomeViewController.configurePhotosCollectionViewAfterResize() (in APTX)
(compiler-generated:0)
12 APTX 0x000000010f6487b5
HomeViewController.windowDidResize(_:) (in APTX) (compiler-generated:0)
13 APTX 0x000000010f6489fd @objc
HomeViewController.windowDidResize(_:) (in APTX) + 109
14 CoreFoundation 0x00007fff35a2b259
__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
....
Thread 0 Crashed:: Dispatch
queue: com.apple.main-thread
0 libsystem_kernel.dylib
0x00007fff6fcff33a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff6fdbfe60 pthread_kill +
430
2 libsystem_c.dylib
0x00007fff6fc86808 abort + 120
3 libc++abi.dylib 0x00007fff6ceed458 abort_message + 231
4 libc++abi.dylib 0x00007fff6cede8bf
demangling_terminate_handler() + 262
5 libobjc.A.dylib
0x00007fff6ea19a57 _objc_terminate() + 96
6 libc++abi.dylib 0x00007fff6ceec887 std::__terminate(void
(*)()) + 8
7 libc++abi.dylib
0x00007fff6ceef387 __cxa_rethrow + 99
8 libobjc.A.dylib 0x00007fff6ea17e1c objc_exception_rethrow 37
9 com.apple.AppKit 0x00007fff32d79153
__NSWindowGetDisplayCycleObserverForLayout_block_invoke + 577
10 com.apple.AppKit 0x00007fff32d781f2
NSDisplayCycleObserverInvoke + 155
11 com.apple.AppKit
0x00007fff32d77d7c NSDisplayCycleFlush + 937
12 com.apple.QuartzCore 0x00007fff4153ce40
CA::Transaction::run_commit_handlers(CATransactionPhase) + 106
13 com.apple.QuartzCore 0x00007fff4153bb52
CA::Transaction::commit() + 230
14 com.apple.AppKit 0x00007fff32fec726 -[NSMoveHelper
_doAnimation] + 64
15 com.apple.AppKit 0x00007fff32feb620[NSMoveHelper(NSSheets) _moveParent:andOpenSheet:] + 1448
16 com.apple.AppKit 0x00007fff32feb052 -[NSWindow(NSSheets)
_orderFrontRelativeToWindow:] + 164
17 com.apple.AppKit 0x00007fff32df3bb2 -[NSWindow
_reallyDoOrderWindowAboveOrBelow:relativeTo:findKey:forCounter:force:isModal:] 2217
18 com.apple.AppKit 0x00007fff32df2fb2 -[NSWindow
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 135
19 com.apple.AppKit 0x00007fff32df1f3e -[NSWindow
_doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 293
20 com.apple.AppKit 0x00007fff32f945a9 -[NSApplication
_orderFrontModalWindow:relativeToWindow:] + 232
21 com.apple.AppKit 0x00007fff32fea89a -[NSWindow
_beginWindowBlockingModalSessionForSheet:service:completionHandler:isCritical:] 585
22 com.apple.AppKit 0x00007fff33047fd0 __54-[NSAlert
beginSheetModalForWindow:completionHandler:]_block_invoke + 281
23 com.apple.AppKit 0x00007fff33044755 -[NSAlert
beginSheetModalForWindow:completionHandler:] + 98
24 com.ail.aptxx 0x000000010f62eddf specialized
OtherHelper.showAlert(window:title:message:isInformational:arrButtonTitles:responseHandler:)
(in APTX) (compiler-generated:0)
25 com.ail.aptxx 0x000000010f60fc48
HomeViewController.checkForPhotosAppOpened() (in APTX)
(HomeViewController.swift:1408)
26 com.ail.aptxx 0x000000010f603fae
HomeViewController.viewWillAppear() (in APTX) (HomeViewController.swift:117)
27 com.ail.aptxx 0x000000010f604428 @objc
HomeViewController.viewWillAppear() (in APTX) (compiler-generated:0)