From 70c7382a099726e94542c57aa75b910dd614ad09 Mon Sep 17 00:00:00 2001 From: Ryan Goldstein Date: Wed, 1 May 2019 21:20:54 -0400 Subject: [PATCH] Fix the request_animation_frame lifetimes --- src/platform_impl/stdweb/window.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/platform_impl/stdweb/window.rs b/src/platform_impl/stdweb/window.rs index 12fbaba5..3008dd58 100644 --- a/src/platform_impl/stdweb/window.rs +++ b/src/platform_impl/stdweb/window.rs @@ -71,10 +71,13 @@ impl Window { register(&target.runner, &canvas); let runner = target.runner.clone(); - let redraw = Box::new(move || window().request_animation_frame(|| runner.send_event(Event::WindowEvent { - window_id: RootWI(WindowId), - event: WindowEvent::RedrawRequested - }))); + let redraw = Box::new(move || { + let runner = runner.clone(); + window().request_animation_frame(move |_| runner.send_event(Event::WindowEvent { + window_id: RootWI(WindowId), + event: WindowEvent::RedrawRequested + })); + }); let window = Window { canvas,