aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@users.noreply.github.com>2024-02-10 10:38:11 +1000
committerGitHub <noreply@github.com>2024-02-10 10:38:11 +1000
commit2ead0ce5904289859ef6e5028645d7349b472400 (patch)
treefe331a1f2ab014f86dac9e90a60a7811afe385c3
parenta992b098e15cc760bff8b27f42268c769181b0e9 (diff)
parent45b3b00fba17e1d820285620707679c51e7f43c0 (diff)
Merge pull request #24637 from kambala-decapitator/nexus-darwin-gamecontroller-fix-leak
[BP][darwin] fix retain cycle in Gamecontroller
-rw-r--r--xbmc/platform/darwin/peripherals/Input_Gamecontroller.mm3
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, *))
{