diff options
author | Andrey Filipenkov <decapitator@ukr.net> | 2024-02-03 19:03:58 +0300 |
---|---|---|
committer | Andrey Filipenkov <decapitator@ukr.net> | 2024-02-03 23:17:43 +0300 |
commit | 45b3b00fba17e1d820285620707679c51e7f43c0 (patch) | |
tree | ee89e01d25217c9c824b312c66429e2f21d4c5b1 | |
parent | f1caa0dc88bf290bdb348e3bab26f0c43e75296b (diff) |
fix retain cycle in Darwin Gamecontroller
-rw-r--r-- | xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm index ec39c0700e..4b8f17dcca 100644 --- a/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm +++ b/xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm @@ -200,6 +200,7 @@ struct PlayerControllerState - (void)microValueChangeHandler:(GCController*)controller { + auto __unsafe_unretained controllerInBlock = controller; controller.microGamepad.valueChangedHandler = ^(GCMicroGamepad* gamepad, GCControllerElement* element) { NSString* message; @@ -233,7 +234,7 @@ struct PlayerControllerState message = [self checkdpad:gamepad.dpad withEvent:&newEvent withInputInfo:InputValueInfo{GCCONTROLLER_TYPE::MICRO} - withplayerIndex:static_cast<int>(controller.playerIndex)]; + withplayerIndex:static_cast<int>(controllerInBlock.playerIndex)]; } if (@available(iOS 13.0, tvOS 13.0, macOS 10.15, *)) { |