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

Fix: When AppLifecycleIntegration is closed, it should remove observer using UI thread #1459

Merged
merged 2 commits into from
May 5, 2021

Conversation

marandaneto
Copy link
Contributor

@marandaneto marandaneto commented May 4, 2021

📜 Description

Fix: When AppLifecycleIntegration is closed, it should remove observer using UI thread

💡 Motivation and Context

2021-05-04 16:20:05.210 27271-27444/xxx E/Sentry: Error while closing the Hub.
java.lang.IllegalStateException: Method removeObserver must be called on the main thread
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)
at androidx.lifecycle.LifecycleRegistry.removeObserver(LifecycleRegistry.java:219)
at io.sentry.android.core.AppLifecycleIntegration.close(AppLifecycleIntegration.java:94)
at io.sentry.core.Hub.close(Hub.java:246)
at io.sentry.core.Sentry.close(Sentry.java:216)
at io.sentry.core.HubAdapter.close(HubAdapter.java:57)
at io.sentry.core.ShutdownHookIntegration.lambda$register$0(ShutdownHookIntegration.java:25)
at io.sentry.core.-$$Lambda$ShutdownHookIntegration$92gaGRLn-MU5DyRe0eDeeyrGh5g.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:764)

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marandaneto marandaneto merged commit a38fde8 into main May 5, 2021
@marandaneto marandaneto deleted the fix/remove-observer-mainthread branch May 5, 2021 07:39
This pull request was closed.
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.

2 participants