I figured the obvious suspects were bad serialization, a sneaky nil somewhere, or threading. But I couldn't find any of those.
Eventually I took the stacktrace at its word - the fact it's doing string comparisons implies it's something to do with the key of the NSDictionary, nothing to do with the value.
I think this may have something to do with the binding code as well, given the presence of ___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke. If I comment out the actual binder.bindShortcut(...) call it doesn't happen, but that may be a red herring. Oh, and the original crash happened when setting up the second keybinding. I.e. it works once, but fails after the first binding set up.
Anyway, I don't know if you want to investigate, feel free to close. I just figured it might at least help some poor soul googling for the same issue.
After upgrading to MacOS monterey, I consistently saw the following crash in slinger, a window management app I maintain.
lldb shows the stacktrace as follows:
I figured the obvious suspects were bad serialization, a sneaky
nil
somewhere, or threading. But I couldn't find any of those.Eventually I took the stacktrace at its word - the fact it's doing string comparisons implies it's something to do with the key of the NSDictionary, nothing to do with the value.
Somehow I turned up this thread from 7 years ago: https://stackoverflow.com/questions/24208594/swift-string-manipulation-causing-exc-bad-access It's slightly different, yet the same fix works - pass an NSString key instead of a swift
String
.Here's the actual fix I made to slinger: https://github.com/timbertson/Slinger.app/commit/dc55f531be1c07c03529b84676f1461ea6a589df
I think this may have something to do with the binding code as well, given the presence of
___CFPrefsDeliverPendingKVONotificationsGuts_block_invoke
. If I comment out the actualbinder.bindShortcut(...)
call it doesn't happen, but that may be a red herring. Oh, and the original crash happened when setting up the second keybinding. I.e. it works once, but fails after the first binding set up.Anyway, I don't know if you want to investigate, feel free to close. I just figured it might at least help some poor soul googling for the same issue.