Skip to content

Commit 361fe34

Browse files
andyleisersonjimblandy
authored andcommitted
Check the parent texture in TextureView::try_raw
1 parent fc6c529 commit 361fe34

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

wgpu-core/src/resource.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ impl Buffer {
458458
.ok_or_else(|| DestroyedResourceError(self.error_ident()))
459459
}
460460

461-
pub(crate) fn check_destroyed<'a>(
462-
&'a self,
463-
guard: &'a SnatchGuard,
461+
pub(crate) fn check_destroyed(
462+
&self,
463+
guard: &SnatchGuard,
464464
) -> Result<(), DestroyedResourceError> {
465465
self.raw
466466
.get(guard)
@@ -1217,6 +1217,16 @@ impl Texture {
12171217
.ok_or_else(|| DestroyedResourceError(self.error_ident()))
12181218
}
12191219

1220+
pub(crate) fn check_destroyed(
1221+
&self,
1222+
guard: &SnatchGuard,
1223+
) -> Result<(), DestroyedResourceError> {
1224+
self.inner
1225+
.get(guard)
1226+
.map(|_| ())
1227+
.ok_or_else(|| DestroyedResourceError(self.error_ident()))
1228+
}
1229+
12201230
pub(crate) fn get_clear_view<'a>(
12211231
clear_mode: &'a TextureClearMode,
12221232
desc: &'a wgt::TextureDescriptor<(), Vec<wgt::TextureFormat>>,
@@ -1810,6 +1820,7 @@ impl TextureView {
18101820
&'a self,
18111821
guard: &'a SnatchGuard,
18121822
) -> Result<&'a dyn hal::DynTextureView, DestroyedResourceError> {
1823+
self.parent.check_destroyed(guard)?;
18131824
self.raw
18141825
.get(guard)
18151826
.map(|it| it.as_ref())

0 commit comments

Comments
 (0)