Skip to content
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

iOS: Fix memory leak on touch input [3.x] #69200

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

tbveralrud
Copy link
Contributor

@tbveralrud tbveralrud commented Nov 26, 2022

Fixes #66422 for 3.x branch. A fix for master is at #69201.

Replaces gesture recognizer with touch events directly from the view.

Rationale:
Gesture recognizers retain all touch events until their state property changes to "cancelled" or "ended."
The custom recognizer in the project fails to implement this requirement.
Setting the state to "ended" in the recognizer resolves the leak but introduces runtime assertions in logic that relied on an unending recognizer.

By forwarding the touch events directly from the view to Godot removes the need for a gesture recognizer.

Furthermore, the motivation for delaying touch inputs looks to be resolved too. (See #39624)
This branch removes the delay from touch events, putting iOS on parity with other platforms.
Project setting input_devices/pointing/ios/touch_delay has been removed as a consequence.

@tbveralrud tbveralrud requested review from a team as code owners November 26, 2022 08:11
@tbveralrud tbveralrud changed the title iOS: Fix memory leak on touch input iOS: Fix memory leak on touch input [3.x] Nov 26, 2022
@akien-mga akien-mga added this to the 3.6 milestone Nov 26, 2022
@djrain
Copy link

djrain commented Feb 5, 2023

Just tested this in our game that uses quick tap controls. It indeed resolved the memory leak, and even more importantly, it eliminated the horrible input stutters / frame drops that were making the game unplayable even on new iPhones. Very much looking forward to seeing this merged, great work!

@tbveralrud
Copy link
Contributor Author

@bruvzg This has been rebased.

Replaces iOS gesture with touch implementation

Fixes godotengine#66422

Remove godot_view_gesture_recognizer

It's now unused.

Remove input_devices/pointing/ios/touch_delay

Unused with removal of gesture.

Remove unused methods from interface

Implementation made obsolete in prior commit

Style conformance
@tbveralrud
Copy link
Contributor Author

...and once more with a squash.

@akien-mga akien-mga merged commit 8adf265 into godotengine:3.x Feb 17, 2023
@akien-mga
Copy link
Member

Thanks!

@oeleo1
Copy link

oeleo1 commented Feb 18, 2023

Good stuff! Thanks all.

Maybe the problem was hidden for us since the touch_delay was set to 0.01, but will definitely give it a try on the next RC,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants