Institut de Chimie Moléculaire de l’Université de Bourgogne
(ICMUB) — UMR 6302
U.F.R. Sciences et Techniques, Bâtiment Mirande
Aile B, bureau 413
9, avenue Alain Savary — B.P. 47870
21078 DIJON CEDEX
On Apr 16, 2015, at 19:40 , Jean Suisse <jean....@gmail.com> wrote:
Dear all,I have this ObjC / Swift application with a swift class that contains:1. Variable & outlets & BindingsA NSPopUpButton and a member variable tied to the button’s selected value (File’s Owner.self.someDevicePopupButton)@IBOutlet weak var someDevicePopupButton: NSPopUpButton!dynamic var someDeviceName: String = ""2. Initialization of the popup button in:override func windowDidLoad(){...let sensors = deviceManager.listOfAllAvailableDevicesOfKind(DEVICE_SENSOR) + [""]self.someDevicePopupButton.removeAllItems()self.someDevicePopupButton.addItemsWithTitles(sensors)self.someDevicePopupButton.safelySelectItemWithTitle(the device that was last used, createIfNeeded: NO)...}
An empty string is added to the list of all available devices because in this particular experiment (it is a scientific software) the user may not want to select any device.Initially, the last used device is selected. And when I select the empty string "" in the NSPopUpButton… the app crashes with a bad access in CFStringCreateCopy (see below).If I replace + [""] with + ["-"] everything works fine.Is it a bug or something I missed ? Is there something special with Swift empty strings that I should know?Thanks,Jean
<PastedGraphic-1.png><PastedGraphic-3.png><PastedGraphic-4.png>