App crashed by using OptionSet with multiple members

#0	0x00000001cc60efb8 in swift_getAssociatedTypeWitnessSlowImpl(swift::MetadataRequest, swift::TargetWitnessTable<swift::InProcess>*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*, swift::TargetProtocolRequirement<swift::InProcess> const*) ()
#1	0x00000001cc60db9c in swift_getAssociatedTypeWitness ()
#2	0x00000001cc3c4990 in OptionSet<>.init() ()
#3	0x000000010518c858 in protocol witness for SetAlgebra.init() in conformance UIRectCorner ()
#4	0x0000000105387220 in protocol witness for SetAlgebra.init() in conformance UIControlState ()
#5	0x00000001cc3e82d4 in SetAlgebra.init<τ_0_0>(_:) ()
#6	0x000000010518cb68 in protocol witness for SetAlgebra.init<τ_0_0>(_:) in conformance UIRectCorner ()
#7	0x00000001053871b0 in protocol witness for SetAlgebra.init<τ_0_0>(_:) in conformance UIControlState ()
#8	0x00000001cc3e8760 in SetAlgebra<>.init(arrayLiteral:) ()
#9	0x0000000105c3d2a0 in closure #1 in Ypp.InfoBaseCell.selectButton.getter at /Volumes/DengData/Dev/vcpack/repo/project-vc/base/vchub/source/YppUtils/Standard/UIKit/Cell/InfoBase/InfoBaseCell.swift:98
#10	0x0000000105c3d0c0 in Ypp.InfoBaseCell.selectButton.getter at /Volumes/DengData/Dev/vcpack/repo/project-vc/base/vchub/source/YppUtils/Standard/UIKit/Cell/InfoBase/InfoBaseCell.swift:82
#11	0x0000000105c3c22c in Ypp.InfoBaseCell.setupSubviews() at /Volumes/DengData/Dev/vcpack/repo/project-vc/base/vchub/source/YppUtils/Standard/UIKit/Cell/InfoBase/InfoBaseCell.swift:44
#12	0x00000001060f7250 in YppSession.SessionCell.setupSubviews() ()
#13	0x0000000105c3b58c in Ypp.InfoBaseCell.cellDidInit() at /Volumes/DengData/Dev/vcpack/repo/project-vc/base/vchub/source/YppUtils/Standard/UIKit/Cell/InfoBase/InfoBaseCell.swift:16
#14	0x0000000106904488 in specialized YLTableView.Cell.init(style:reuseIdentifier:) ()
#15	0x0000000106903480 in @objc YLTableView.Cell.init(style:reuseIdentifier:) ()
#16	0x00000001054164f8 in @objc Ypp.TableViewCell.init(style:reuseIdentifier:) ()
#17	0x0000000105c3e4f0 in Ypp.InfoBaseCell.init(style:reuseIdentifier:) ()
#18	0x0000000105c3e5cc in @objc Ypp.InfoBaseCell.init(style:reuseIdentifier:) ()
#19	0x0000000105d11660 in Ypp.SessionMiniCell.init(style:reuseIdentifier:) ()
#20	0x0000000105d11794 in @objc Ypp.SessionMiniCell.init(style:reuseIdentifier:) ()
#21	0x00000001060f91d4 in specialized YppSession.SessionCell.init(style:reuseIdentifier:) ()
#22	0x00000001060f803c in @objc YppSession.SessionCell.init(style:reuseIdentifier:) ()
#23	0x00000001d46e78bc in -[UITableView _dequeueReusableViewOfType:withIdentifier:] ()
#24	0x00000001d46e7640 in -[UITableView dequeueReusableCellWithIdentifier:] ()
#25	0x00000001d45abc70 in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:] ()
#26	0x00000001d45abb60 in -[UITableView dequeueReusableCellWithIdentifier:forIndexPath:] ()
#27	0x00000001069010f4 in UITableView.dequeue<τ_0_0>(_:indexPath:) ()
#28	0x0000000106901014 in static YLTableView.Cell.dequque(with:indexPath:) ()
#29	0x0000000106104940 in YppSession.SessionListController.tableView(_:cellForRowAt:) ()
#30	0x0000000106105cbc in @objc YppSession.SessionListController.tableView(_:cellForRowAt:) ()
#31	0x00000001d464e828 in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] ()
#32	0x00000001d46221c4 in -[UITableView _updateVisibleCellsForRanges:createIfNecessary:] ()
#33	0x00000001d455b4ac in -[UITableView _updateVisibleCellsNow:] ()
#34	0x00000001d455afa0 in -[UITableView layoutSubviews] ()
#35	0x00000001068f7018 in YLTableView.layoutSubviews() ()
#36	0x00000001068f70dc in @objc YLTableView.layoutSubviews() ()
#37	0x00000001d4506cec in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#38	0x00000001053be1c4 in UIView.ylmainthreadsafe_layoutSublayers(of:) ()
#39	0x00000001053be36c in @objc UIView.ylmainthreadsafe_layoutSublayers(of:) ()
#40	0x00000001d39e34e8 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#41	0x00000001d39f6b9c in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#42	0x00000001d3a08098 in CA::Context::commit_transaction(CA::Transaction*, double, double*) ()
#43	0x00000001d3a3f3c4 in CA::Transaction::commit() ()
#44	0x00000001d3a26408 in CA::Transaction::flush_as_runloop_observer(bool) ()
#45	0x00000001d4a06fb0 in _UIApplicationFlushCATransaction ()
#46	0x00000001d4b53678 in _UIUpdateSequenceRun ()
#47	0x00000001d5192904 in schedulerStepScheduledMainSection ()
#48	0x00000001d5191ad0 in runloopSourceCallback ()
#49	0x00000001d244a22c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#50	0x00000001d2456614 in __CFRunLoopDoSource0 ()
#51	0x00000001d23da51c in __CFRunLoopDoSources0 ()
#52	0x00000001d23efeb8 in __CFRunLoopRun ()
#53	0x00000001d23f51e4 in CFRunLoopRunSpecific ()
#54	0x000000020b215368 in GSEventRunModal ()
#55	0x00000001d48a4d88 in -[UIApplication _run] ()
#56	0x00000001d48a49ec in UIApplicationMain ()
#57	0x0000000104deea5c in main at /Volumes/DengData/Dev/vcpack/ios-build/Odin-YMS/AppDelegate.swift:5
#58	0x00000001f0719948 in start ()

It runs fine in Release mode but crashes in Debug mode (or if optimization level is [-Onone] )

More Infomation:
The framework with the crash code is link with other pre-build frameworks(which BUILD_LIBRARY_FOR_DISTRIBUTION=YES)
and if we import the source code of all linked frameworks, the issue gone

2 Likes

The "disabled" word is highlighted in a peculiar way on your screenshot - in green in one place and in purple in another. To rule out any funny business try using it in a fully prefixed form UIButton.State.disabled to see if the bug is still there or gone.

1 Like

same issue with Xcode15 but only in beta builds. My workaround is listening to just ONE UIControEvent at a time instead of passing in an array of events. I am suspecting there's a bug between OptionSet in Swift to bitmask in Objc.