mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
Web: fix crash with ControlFlow::Wait|WaitUntil
This commit is contained in:
@@ -9,7 +9,9 @@ PR's changelog entry would go into the wrong section).
|
|||||||
And please only add new entries to the top of this list, right below the `#
|
And please only add new entries to the top of this list, right below the `#
|
||||||
Unreleased` header.
|
Unreleased` header.
|
||||||
|
|
||||||
# Unreleased
|
# 0.29.13
|
||||||
|
|
||||||
|
- On Web, fix possible crash with `ControlFlow::Wait` and `ControlFlow::WaitUntil`.
|
||||||
|
|
||||||
# 0.29.12
|
# 0.29.12
|
||||||
|
|
||||||
|
|||||||
@@ -117,9 +117,7 @@ impl Schedule {
|
|||||||
let channel = MessageChannel::new().unwrap();
|
let channel = MessageChannel::new().unwrap();
|
||||||
let closure = Closure::new(f);
|
let closure = Closure::new(f);
|
||||||
let port_1 = channel.port1();
|
let port_1 = channel.port1();
|
||||||
port_1
|
port_1.set_onmessage(Some(closure.as_ref().unchecked_ref()));
|
||||||
.add_event_listener_with_callback("message", closure.as_ref().unchecked_ref())
|
|
||||||
.expect("Failed to set message handler");
|
|
||||||
port_1.start();
|
port_1.start();
|
||||||
|
|
||||||
let port_2 = channel.port2();
|
let port_2 = channel.port2();
|
||||||
@@ -178,6 +176,7 @@ impl Drop for Schedule {
|
|||||||
} => {
|
} => {
|
||||||
window.clear_timeout_with_handle(*handle);
|
window.clear_timeout_with_handle(*handle);
|
||||||
port.close();
|
port.close();
|
||||||
|
port.set_onmessage(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user