@@ -496,7 +496,7 @@ fn get_quad_context() -> &'static mut dyn miniquad::RenderingBackend {
496
496
}
497
497
498
498
struct Stage {
499
- main_future : Option < Pin < Box < dyn Future < Output = ( ) > > > > ,
499
+ main_future : Pin < Box < dyn Future < Output = ( ) > > > ,
500
500
}
501
501
502
502
impl EventHandler for Stage {
@@ -723,22 +723,20 @@ impl EventHandler for Stage {
723
723
let result = maybe_unwind (
724
724
get_context ( ) . unwind ,
725
725
AssertUnwindSafe ( || {
726
- if let Some ( future) = & mut self . main_future {
727
- let _z = telemetry:: ZoneGuard :: new ( "Event::draw user code" ) ;
728
-
729
- if exec:: resume ( future) . is_some ( ) {
730
- self . main_future = None ;
731
- miniquad:: window:: quit ( ) ;
732
- return ;
733
- }
734
- get_context ( ) . coroutines_context . update ( ) ;
726
+ let _z = telemetry:: ZoneGuard :: new ( "Event::draw user code" ) ;
727
+
728
+ if exec:: resume ( & mut self . main_future ) . is_some ( ) {
729
+ self . main_future = Box :: pin ( async move { } ) ;
730
+ miniquad:: window:: quit ( ) ;
731
+ return ;
735
732
}
733
+ get_context ( ) . coroutines_context . update ( ) ;
736
734
} ) ,
737
735
) ;
738
736
739
737
if result == false {
740
738
if let Some ( recovery_future) = get_context ( ) . recovery_future . take ( ) {
741
- self . main_future = Some ( recovery_future) ;
739
+ self . main_future = recovery_future;
742
740
}
743
741
}
744
742
@@ -883,7 +881,7 @@ impl Window {
883
881
unsafe { CONTEXT = Some ( context) } ;
884
882
885
883
Box :: new ( Stage {
886
- main_future : Some ( Box :: pin ( future) ) ,
884
+ main_future : Box :: pin ( future) ,
887
885
} )
888
886
} ) ;
889
887
}
0 commit comments