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

Put everything in Context behind the same Mutex #1050

Merged
merged 13 commits into from
Jan 10, 2022
Merged

Conversation

emilk
Copy link
Owner

@emilk emilk commented Jan 8, 2022

Closes #1005

Rebased and continued from #1035

Most of the work was done by @danielkeller

  • Everything in a Context is now behind the same mutex.
  • ⚠️ Context::input and Ui::input now locks a mutex. This can lead to a dead-lock is used in an if let binding!
    • if let Some(pos) = ui.input().pointer.latest_pos() and similar must now be rewritten on two lines, or with added {} around the righ-hand-side.
    • Search for this problem in your code using the regex if let .*input.
  • Context::fonts and Ui::fonts now locks a mutex.
  • Renamed CtxRef to Context.
  • Context can now be cloned and stored between frames.

@emilk emilk mentioned this pull request Jan 8, 2022
The old `Context` is now `ContextImpl` and is non-pub
@emilk emilk changed the title Put everything in Context behind the same Mutex (rebased) Put everything in Context behind the same Mutex Jan 8, 2022
@emilk emilk marked this pull request as ready for review January 8, 2022 16:00
@emilk emilk merged commit d567341 into master Jan 10, 2022
@emilk emilk deleted the ctx-handle-rebased branch January 10, 2022 22:13
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.

CtxRef::clone is a footgun
2 participants