1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Make Context::request_repaint safe to call from any thread.

Closes https://github.com/emilk/egui/issues/1379
This commit is contained in:
Emil Ernerfeldt
2022-03-20 20:53:19 +01:00
parent ccbddcfe95
commit 72d264ed6c
5 changed files with 65 additions and 50 deletions

View File

@@ -159,14 +159,12 @@ impl AppRunner {
let needs_repaint: std::sync::Arc<NeedRepaint> = Default::default();
let egui_ctx = egui::Context::default();
{
let egui_ctx = egui::Context::with_repaint_callback({
let needs_repaint = needs_repaint.clone();
egui_ctx.set_request_repaint_callback(move || {
move || {
needs_repaint.0.store(true, SeqCst);
});
}
}
});
load_memory(&egui_ctx);
if prefer_dark_mode == Some(true) {