Fix restarting the event loop with the GL backend

We must reset the proxy to a queue so one can restart it with pending events
This commit is contained in:
Olivier Goffart 2021-05-11 17:48:56 +02:00
parent 9d0efd243e
commit 0034a3e67d
2 changed files with 8 additions and 3 deletions

View file

@ -28,7 +28,7 @@ TEST_CASE("C++ Timers")
} }
SCENARIO("Quit from event") TEST_CASE("Quit from event")
{ {
int called = 0; int called = 0;
sixtyfps::invoke_from_event_loop([&] { sixtyfps::invoke_from_event_loop([&] {
@ -41,7 +41,7 @@ SCENARIO("Quit from event")
} }
SCENARIO("Event from thread") TEST_CASE("Event from thread")
{ {
std::atomic<int> called = 0; std::atomic<int> called = 0;
auto t = std::thread([&] { auto t = std::thread([&] {

View file

@ -517,7 +517,12 @@ pub fn run(quit_behavior: sixtyfps_corelib::backend::EventLoopQuitBehavior) {
}; };
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
winit_loop.run_return(run_fn); {
winit_loop.run_return(run_fn);
*GLOBAL_PROXY.get_or_init(Default::default).lock().unwrap() = Default::default();
}
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
{ {
// Since wasm does not have a run_return function that takes a non-static closure, // Since wasm does not have a run_return function that takes a non-static closure,