Open gabrieldechichi opened 1 year ago
Fwiw - I get a crash as described on Windows when using egui, but with egui-winit
+ egui-wgpu
instead of eframe
.
The solution is to make sure that egui isn't updating or rendering when the dll is reloaded. Here's how I did it in my case:
let mutex: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
// once at start:
let observer = hot_reload::subscribe();
std::thread::spawn(move || loop {
let block_reload = observer.wait_for_about_to_reload();
let lock = mutex.lock().unwrap();
drop(block_reload);
observer.wait_for_reload();
});
// before rendering/updating the egui state:
let lock = mutex.lock().unwrap();
...
I think it'd be a little trickier if you don't own the main loop, but it should still be doable.
Edit: simplified and made the code more robust
The
hot-egui
example crashes on reload, ifeframe
is updated to version any version above0.19.0
(0.20.0
,0.21.0
or0.22.0
), with the following error:Machine specs:
Repro steps:
hot-egui
example from 0.19.0 to any 0.2x.x versioncargo watch -w lib -x 'build -p lib'
andcargo run --features reload
render
function onlib/src/lib.rs
(I usually remove/add theui.heading
)This is most likely due to a change on
eframe
, but I'm unsure how to debug this. Any suggestions?