///////////////////////////////////////////////////////
| 339 | |
| 340 | //////////////////////////////////////////////////////////// |
| 341 | void JoystickImpl::close() |
| 342 | { |
| 343 | const AutoreleasePool pool; |
| 344 | |
| 345 | for (IOHIDElementRef iohidElementRef : m_buttons) |
| 346 | CFRelease(iohidElementRef); |
| 347 | |
| 348 | m_buttons.clear(); |
| 349 | |
| 350 | for (const auto& [axis, iohidElementRef] : m_axis) |
| 351 | CFRelease(iohidElementRef); |
| 352 | |
| 353 | m_axis.clear(); |
| 354 | |
| 355 | if (m_hat != nullptr) |
| 356 | CFRelease(m_hat); |
| 357 | |
| 358 | m_hat = nullptr; |
| 359 | |
| 360 | // And we unregister this joystick |
| 361 | m_locationIDs[m_index] = 0; |
| 362 | } |
| 363 | |
| 364 | |
| 365 | //////////////////////////////////////////////////////////// |