krevis / MIDIApps

MIDI apps for Mac OS X: MIDI Monitor and SysEx Librarian.
http://www.snoize.com/
BSD 3-Clause "New" or "Revised" License
713 stars 112 forks source link

Sysex Librarian: multiport interface display #79

Closed jeremybernstein closed 3 years ago

jeremybernstein commented 3 years ago

I think this is a regression from pre-BigSur versions. My multiport MIDI interface is displayed properly in the menu when it's open, but only the interface name is displayed when the menu is closed. I've run into this issue before with other software -- the interface name contains a \0 character, which is legal in NSStrings, but causes trouble when names are concatenated. Not sure if that's what's happening here, but it's my suspicion.

Bildschirmfoto 2020-11-16 um 16 55 18 Bildschirmfoto 2020-11-16 um 16 55 24
krevis commented 3 years ago

That's odd! I don't know why it would have changed in Big Sur, or the release I did for Big Sur support.

Do you know where exactly the \0 is in the interface name? And how do you know it's there, when it isn't generally visible?

jeremybernstein commented 3 years ago

If you check out my Audio-MIDI Setup config (attached), you can see the /0s registered by the device, but it's visible in the debugger, as well. It requires some extra love when performing NSString concatenation. This is a pretty old interface and I've never seen this problem with other devices, but it's a device.

I have some code lying around to do "safe" concatenation for cases like this, happy to pass it along, but I'm sure it's nothing surprising or novel to you.

Standard.mcfg.zip

krevis commented 3 years ago

Thank you! Will check that out when I can. I vaguely recall NS/CFString having issues with embedded \0s, but I'm sure I can search for more details if needed.

krevis commented 3 years ago

Looks like Apple introduced a bug in NSPopUpButton. It worked correctly in 10.9 (Mavericks) and 10.11 (El Capitan), but is broken in 10.15.7 (Catalina) and apparently 11.0 (Big Sur) too. (Not sure exactly when it broke -- sometime in that span.)

Worked around it by stripping \0 characters from the item title.

jeremybernstein commented 3 years ago

Thanks!