Rename LoopDestroyed to LoopExiting

Considering the possibility of re-running an event loop via run_ondemand
then it's more correct to say that the loop is about to exit without
assuming it's going to be destroyed.
This commit is contained in:
Robert Bragg 2023-07-28 17:19:53 +01:00 committed by GitHub
parent 755c533b08
commit 935146d299
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 28 additions and 30 deletions

View file

@ -585,7 +585,7 @@ impl<T: 'static> Shared<T> {
let mut control = self.current_control_flow();
// We don't call `handle_loop_destroyed` here because we don't need to
// perform cleanup when the web browser is going to destroy the page.
self.handle_event(Event::LoopDestroyed, &mut control);
self.handle_event(Event::LoopExiting, &mut control);
}
// handle_event takes in events and either queues them or applies a callback
@ -665,7 +665,7 @@ impl<T: 'static> Shared<T> {
}
fn handle_loop_destroyed(&self, control: &mut ControlFlow) {
self.handle_event(Event::LoopDestroyed, control);
self.handle_event(Event::LoopExiting, control);
let all_canvases = std::mem::take(&mut *self.0.all_canvases.borrow_mut());
*self.0.page_transition_event_handle.borrow_mut() = None;
*self.0.on_mouse_move.borrow_mut() = None;