At a wild guess, I'd suggest that the NSButton is being overreleased somewhere. However, if your app is 100% Swift, or is Obj-C but 100% ARC, then it's kind of hard to overrelease anything directly.
One other possible cause of an overrelease is that the pointer to the NSButton (or any of the other objects implicated in the above backtrace) may refer to memory that was previously used for a different object. If any code had a reference that persisted after the lifetime of that object, it could happen that eventually a release occurs, but it now hits the object currently using the same memory. This kind of thing can be very hard to find.
Perhaps the key question is what changes when your app goes into the background? If you do anything special, I'd start looking there. If not, it may be a red herring (your app might be surviving in the foreground purely by luck).
The other area where it's easy to make a mistake is where a delegate object reference is unretained, but you don't realize that, and fail to provide for something to keep the delegate object alive.
Note that Swift is a bit more robust to these kinds of errors than Obj-C, and ARC is more robust than non-ARC. If you have any kind of mixed source app, then start by looking in the more dangerous places.
What QuinceyMorris said plus…
You should try running your app with zombies enabled. Bugs like this can be hard to find because there’s a big gap between the problem (the over-release) and the failure (this crash). Zombies helps to reduce that gap.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"