* Fix code that could lead to a possible deadlock.
Drop implementations are not called until the end of a statement. The statement changed in this commit therefore took 4 read locks on a RwLock which can lead to problems if a write lock is requested between any of these read locks. The code looks like it would only hold one lock at a time but it does not drop any of the locks until after the arithmatic operations complete, which leads to this situation. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=996079046184329f3a9df1cd19c87da8 to see this in action. The fix is to just take one lock and share it between the three calls to num_presses, letting it drop at the end of the scope.
* Fix code that may cause a deadlock in `MenuRoot::stationary_interaction`
The issue here is related to that in 9673b8f2a0 in that the lock is not dropped when it is expected. Since the `RwLockReadGuard` produced by `ctx.input()` has a reference taken from it (one into `pointer`), the lock cannot be dropped until that reference is no longre valid, which is the end of the scope (in this case this function). The following `ctx.input()` then attempts to aquire a second lock on the `RwLock`, creating the same situation that was found in the referenced commit.
This has been resolved by holding one lock on the input for the whole function.
* Reference this PR from comments in the code for future maintainers
* Add the change to the changelog
* Use full link to PR
* Use full link to PR
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.
eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.
Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.
This is the first callback added to the egui API, which otherwise is
completely driven by data.
The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
* egui_web: use tracing crate
* egui_glow: use tracing crate
* Log at the debug level
* egui_demo_app: enable tracing to log to stdout
* Use tracing in egui-winit
* Add opt-in tracing support to egui
* Fix Orientation not exposed, although there are public fields with its type
* Implement formatters for X/Y axis labels
* Use array instead of separate X/Y formatters
* Swap axis formatters if charts are horizontal
* Review suggestions
* Refactor text layout: don't need &Fonts in all functions
* Replace indexing in Fonts with member function
* Wrap Fonts in a Mutex
* Remove mutex for Font::glyph_info_cache
* Remove RwLock around Font::characters
* Put FontsImpl and GalleyCache behind the same Mutex
* Round font sizes to whole pixels before deduplicating them
* Make TextStyle !Copy
* Implement user-named TextStyle:s
* round font size earlier
* Cache fonts based on family and size
* Move TextStyle into egui and Style
* Remove body_text_style
* Query graphics about max texture size and use that as font atlas size
* Recreate texture atlas when it is getting full
* Move texture allocation into epaint/egui proper
* Add TextureHandle
* egui_glow: cast using bytemuck instead of unsafe code
* Optimize glium painter
* Optimize WebGL
* Add example of loading an image from file
* Move all interior mutability from Context to CtxRef and make it a handle
* Rename `CtxRef` to `Context`
* The old `Context` is now `ContextImpl` and is non-pub
* Add benchmark Painter::rect
Co-authored-by: Daniel Keller <dklr433@gmail.com>
* Split `Event::Text` into `Text` and `Paste`
* Added explicit Event::Paste change
See #1043
* Link to PR in changelog (not the issue)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>