Skip to content

Commit 38c63c2

Browse files
matkladnot-fl3
authored andcommitted
Don't leak main future
This helps with shutdown sequence, if, eg, the user-supplied futures holds onto some channels or some such.
1 parent 43ad91d commit 38c63c2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ static mut MAIN_FUTURE: Option<Pin<Box<dyn Future<Output = ()>>>> = None;
436436

437437
struct Stage {}
438438

439+
impl Drop for Stage {
440+
fn drop(&mut self) {
441+
unsafe {
442+
MAIN_FUTURE.take();
443+
}
444+
}
445+
}
446+
439447
impl EventHandler for Stage {
440448
fn resize_event(&mut self, ctx: &mut miniquad::Context, width: f32, height: f32) {
441449
set_quad_context(ctx);

0 commit comments

Comments
 (0)