You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::time::Duration;use async_winit::event_loop::{EventLoop,EventLoopBuilder};use async_winit::window::Window;use async_winit::{DefaultThreadSafety,Timer};use futures_lite::prelude::*;fnmain(){main2(EventLoopBuilder::new().build())}fnmain2(evl:EventLoop){let target = evl.window_target().clone();
evl.block_on(asyncmove{// Wait for a resume event to start.
target.resumed().await;// Create a window.let window = Window::<DefaultThreadSafety>::new().await.unwrap();// Print resize events.let print_resize = {async{loop{let new_size = window.resized().wait().await;println!("(1) Window resized to {:?}", new_size);}}};let print_resize_again = {async{loop{let new_size = window.resized().wait().await;println!("(2) Window resized to {:?}", new_size);}}};// Wait for the window to close.async{ window.close_requested().wait().await}.or(print_resize).or(print_resize_again)// comment this to make it work.await;// Exit.
target.exit().await});}
The above gets stuck in an infinite loop printing (1) and (2) alternatively:
The above gets stuck in an infinite loop printing (1) and (2) alternatively:
With only one "print_resize" it works correctly. The issue might be in
handler::Waiter
. In my understanding, when a resize event is received:Waiter::poll_next
notifies the next one in the chain (2).resized().wait()
again, adding itself at the end of the list of listenersWaiter::poll_next
notifies the next one in the chain, i.e. (1) which just added itselfresized().wait()
again, adding itself at the end of the list of listenersThe text was updated successfully, but these errors were encountered: