servoshell: fix unwrap None during RedrawRequested (#30360)

This commit is contained in:
Delan Azabani 2023-09-14 18:13:19 +08:00 committed by GitHub
parent 988e05a68b
commit 2076b5d789
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,8 +173,16 @@ impl App {
app.windows.insert(window.id(), window.clone());
app.servo = Some(servo);
},
_ => {},
}
winit::event::Event::RedrawRequested(_) => {
// If self.servo is None here, it means that we're in the process of shutting down,
// let's ignore events.
if app.servo.is_none() {
return;
}
if let winit::event::Event::RedrawRequested(_) = e {
// We need to redraw the window for some reason.
trace!("RedrawRequested");
@ -194,15 +202,6 @@ impl App {
// By default, the next RedrawRequested event will need to recomposite.
need_recomposite = true;
},
_ => {},
}
// If self.servo is None here, it means that we're in the process of shutting down,
// let's ignore events.
if app.servo.is_none() {
return;
}
// Handle the event