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

[Mono.Android] Dispose of the RunnableImplementor on error #8907

Merged
merged 1 commit into from May 6, 2024

Conversation

jonpryor
Copy link
Member

Context: 3ce27c9

Commit 3ce27c9 had a TODO:

TODO: Address 1 and dispose of the RunnableImplementor instance
when View.Post() returns false.

The time is now! Review all new RunnableImplementor(…, true) calls, and if a "removable" RunnableImplementor is passed to a method which can return an error such as Handler.post() or View.post(), dispose of the RunnableImplementor instance on error.

Footnotes

  1. we leak if View.post(Runnable) returns false.

Context: 3ce27c9

Commit 3ce27c9 had a TODO:

> TODO: Address [^0] and dispose of the `RunnableImplementor` instance
> when `View.Post()` returns `false`.
>
> [^0]: we leak if `View.post(Runnable)` returns *false*.

The time is now!  Review all `new RunnableImplementor(…, true)` calls,
and if a "removable" `RunnableImplementor` is passed to a method
which can return an error such as [`Handler.post()`][0] or
[`View.post()`][1], dispose of the `RunnableImplementor` instance
on error.

[0]: https://developer.android.com/reference/android/os/Handler#post(java.lang.Runnable)
[1]: https://developer.android.com/reference/android/view/View#post(java.lang.Runnable)
@jonpryor jonpryor merged commit 0781fac into main May 6, 2024
48 checks passed
@jonpryor jonpryor deleted the dev/jonp/jonp-dispose-runnable-on-failure branch May 6, 2024 16:22
grendello added a commit that referenced this pull request May 7, 2024
* main:
  Update README (#8913)
  Bumps to xamarin/java.interop@4e893bf (#8924)
  Bump to dotnet/installer@fa261b952d 9.0.100-preview.5.24253.16 (#8921)
  [Mono.Android] Dispose of the `RunnableImplementor` on error (#8907)
  Bump NDK to r26d (#8868)
  Bump to dotnet/installer@d301a122c4 9.0.100-preview.5.24229.2 (#8912)
  Localized file check-in by OneLocBuild Task (#8910)
  LEGO: Merge pull request 8909
  [api-merge] Add `removed-since` info (#8897)
  Bump to xamarin/monodroid@9ca6d9f6 (#8895)
  [Xamarin.Android.Build.Tasks] fix detection of "Android libraries" (#8904)
grendello added a commit that referenced this pull request May 7, 2024
* main:
  Update README (#8913)
  Bumps to xamarin/java.interop@4e893bf (#8924)
  Bump to dotnet/installer@fa261b952d 9.0.100-preview.5.24253.16 (#8921)
  [Mono.Android] Dispose of the `RunnableImplementor` on error (#8907)
  Bump NDK to r26d (#8868)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants