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

Do not panic in Application::try_global if Application is not created #1996

Merged
merged 3 commits into from
Oct 3, 2021

Conversation

maan2003
Copy link
Collaborator

@maan2003 maan2003 commented Oct 1, 2021

Application::try_global called assert_main_thread but before Application is created the main thread is unclaimed.
I think there was no way for Application::try_global to return None.

Added assert_main_thread_or_main_unclaimed that does not panic if main thread is unclaimed.

Fixes #1995

@maan2003 maan2003 changed the title remove assert_main_thread from Application::try_global Do not panic in Application::try_global if main thread is unclaimed Oct 1, 2021
@maan2003 maan2003 changed the title Do not panic in Application::try_global if main thread is unclaimed Do not panic in Application::try_global if Application is not created Oct 1, 2021
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

This makes sense, a few little thoughts inline!

druid-shell/src/util.rs Outdated Show resolved Hide resolved
druid-shell/src/util.rs Outdated Show resolved Hide resolved
`Application::try_global` called `assert_main_thread` but before
Application is running the main thread is unclaimed. I think there was
no way that `Application::try_global` to return None.

Added `assert_main_thread_or_main_unclaimed` that does not panic
if main thread is unclaimed.
gtk and mac backends have their own assert_main_thread
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.

X11: calling Screen::get_monitors panics
2 participants