mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Fix panic in surface cleanup
This commit is contained in:
committed by
Dzmitry Malyshau
parent
f2a18ee57c
commit
450defb743
@@ -724,6 +724,14 @@ impl<A: HalApi, F: GlobalIdentityHandlerFactory> Hub<A, F> {
|
||||
|
||||
for element in surface_guard.map.iter_mut() {
|
||||
if let Element::Occupied(ref mut surface, _epoch) = *element {
|
||||
if surface
|
||||
.presentation
|
||||
.as_ref()
|
||||
.map_or(wgt::Backend::Empty, |p| p.backend())
|
||||
!= A::VARIANT
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if let Some(present) = surface.presentation.take() {
|
||||
let device = &devices[present.device_id.value];
|
||||
let suf = A::get_surface_mut(surface);
|
||||
|
||||
@@ -36,6 +36,12 @@ pub(crate) struct Presentation {
|
||||
pub(crate) acquired_texture: Option<Stored<TextureId>>,
|
||||
}
|
||||
|
||||
impl Presentation {
|
||||
pub(crate) fn backend(&self) -> wgt::Backend {
|
||||
crate::id::TypedId::unzip(self.device_id.value.0).2
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
pub enum SurfaceError {
|
||||
#[error("surface is invalid")]
|
||||
|
||||
Reference in New Issue
Block a user