-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MacOS 15.3.2 on Apple Silicon M1: Crash when game controller is disconnected #12807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I forgot to report that the application becomes stable once I remove the |
Can you look and see why |
Oh, it is set to true, that's the reason why the crashing IOHID functions are called at all (when they obviously shouldn't be, because Perhaps I was a bit ambigous. The present code in
Obviously,
And, a new insight: I found an old Intel Mac Mini running MacOS 12.7.6. It behaves the same way as my M1 with 15.3.2. The application crashes with said exception in In my opinion, the additional condition If the condition |
Seems that I created duplicated bug report So I just copy-paste here. It's a regression since 8b0c9e1 I just disconnect the bluetooth device when game is started to reproduce it. I tested it on macOS 15.1.1 with Sony DualSense controller and it crashes every time. We get a lot of crash reports related to this change recently and tbh. I didn't notice any crash in this code before 8b0c9e1. |
That's exactly where I found the following discussions on libusb/hidapi, their code looks familiar: libusb/hidapi#144 They tested up to MacOS 11 only. I wonder why there are no corresponding bug reports there. Perhaps we should rename the flag to |
I just checked crash reports and the oldest version where current SDL crashes is 10.15.7. I see macOS 11, 12, 13 etc. either. And I didn't see any similar crash before this patch. So maybe there is other reason of the issue that the Also I didn't look at the details but I saw some differences between libusb hidapi code and SDL hidapi code. |
I reactivated my oldest Mac (Intel), running MacOS 10.15.7. The application, in the moment Bluetooth is switched off, crashes in The only significant difference that I see between SDL hidapi and libusb/hidapi code is that libusb/hidapi does a I don't know how those guys at libusb tested, but I still suggest to undo 8b0c9e1. |
Whenever - while a Bluetooth game controller is connected to a running SDL application on a current Mac M1 - the controller is disconnected or Bluetooth is disabled, the application will crash with an exception "assertion failure: Device has already been activated/cancelled" during the next call to
SDL_PollEvent()
orSDL_WaitEvent()
.This exception is raised by
IOHIDDeviceRegisterInputReportCallback()
or (if the former is avoided)IOHIDDeviceClose()
inhid_close()
in "hidapi/mac/hid.c". These function calls are both subject to the following conditions:if (is_macos_10_10_or_greater || !dev->disconnected) {
The flag
dev->disconnected
gets set correctly beforehand, so the culprit seems to be the switchis_macos_10_10_or_greater
. There is a comment in the code saying the two functions crashed before MacOS 10.15 when unplugging a controller, but later it was the other way round (crash if they were not called). It appears that this issue still exists on MacOS 15.3.2, at least on the M1 platform.Can anyone check if it happens on the Intel platform or on other MacOS versions later than 10.15?
The text was updated successfully, but these errors were encountered: