surface: Don't crash due to weird state after resume
This commit is contained in:
parent
77d3605fb9
commit
7c3e18b588
1 changed files with 20 additions and 1 deletions
|
|
@ -746,8 +746,27 @@ impl SurfaceThreadState {
|
|||
let Some(compositor) = self.compositor.as_mut() else {
|
||||
return;
|
||||
};
|
||||
|
||||
// handle edge-cases right after resume
|
||||
if !matches!(
|
||||
self.state,
|
||||
QueueState::WaitingForVBlank { .. } | QueueState::Idle
|
||||
) {
|
||||
match mem::replace(&mut self.state, QueueState::Idle) {
|
||||
QueueState::WaitingForVBlank { .. } | QueueState::Idle => unreachable!(),
|
||||
QueueState::Queued(token) | QueueState::WaitingForEstimatedVBlank(token) => {
|
||||
self.loop_handle.remove(token);
|
||||
}
|
||||
QueueState::WaitingForEstimatedVBlankAndQueued {
|
||||
estimated_vblank,
|
||||
queued_render,
|
||||
} => {
|
||||
self.loop_handle.remove(estimated_vblank);
|
||||
self.loop_handle.remove(queued_render);
|
||||
}
|
||||
}
|
||||
}
|
||||
if matches!(self.state, QueueState::Idle) {
|
||||
// can happen right after resume
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue