OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
655 stars 110 forks source link

SIGSEGV crash on Arm64 MacOS in notify.cpp example #263

Closed Maxung closed 1 month ago

Maxung commented 10 months ago

When running the notify example in C++ and connecting to an Adafruit Feather M0 board, the characteristics are correctly listed but subscribing to the specific temperature characteristic results in Exception: EXC_BAD_ACCESS (code=1, address=0x20). Running the notify example in Python works correctly though. The error seems to result from setting the callback for a specific characteristic.

Machine: M1 Macbook Pro OS: macOS Sonoma (14.0) Git tag: 311386e7e02861ba8f11863182ebd340f1de566a

Stack trace:

std::__function::__value_func::swap[abi:v160006](std::__function::__value_func<…> &) function.h:518
std::function::swap(std::function<…> &) function.h:1149
std::function::operator=(const std::function<…> &) function.h:1113
-[PeripheralBaseMacOS notify:characteristic_uuid:callback:] PeripheralBaseMacOS.mm:388
SimpleBLE::PeripheralBase::notify(const std::string &, const std::string &, std::function<…>) PeripheralBase.mm:155
SimpleBLE::Peripheral::notify(const std::string &, const std::string &, std::function<…>) Peripheral.cpp:134
main main.cpp:71
start 0x000000018d91d058
kdewald commented 1 month ago

The underlying issue might have been related to the following fix: https://github.com/OpenBluetoothToolbox/SimpleBLE/pull/326

Feelf free to reopen if the bug persists.