Skip to content

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

Merged
maan2003 merged 3 commits intolinebender:masterfrom
maan2003:fix-1995
Oct 3, 2021
Merged

Do not panic in Application::try_global if Application is not created#1996
maan2003 merged 3 commits intolinebender:masterfrom
maan2003:fix-1995

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!

`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
@maan2003 maan2003 merged commit c132c81 into linebender:master Oct 3, 2021
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