mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
fix: remove deprecated usage of mem::uninitialized
. (#1341)
This commit is contained in:
parent
8a3a32f286
commit
468b6b83ec
|
@ -3,7 +3,7 @@ use stdweb::web::{window, IWindowOrWorker, TimeoutHandle};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Timeout {
|
pub struct Timeout {
|
||||||
handle: TimeoutHandle,
|
handle: Option<TimeoutHandle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Timeout {
|
impl Timeout {
|
||||||
|
@ -12,14 +12,14 @@ impl Timeout {
|
||||||
F: 'static + FnMut(),
|
F: 'static + FnMut(),
|
||||||
{
|
{
|
||||||
Timeout {
|
Timeout {
|
||||||
handle: window().set_clearable_timeout(f, duration.as_millis() as u32),
|
handle: Some(window().set_clearable_timeout(f, duration.as_millis() as u32)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Timeout {
|
impl Drop for Timeout {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let handle = std::mem::replace(&mut self.handle, unsafe { std::mem::uninitialized() });
|
let handle = self.handle.take().unwrap();
|
||||||
handle.clear();
|
handle.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue