Don't raise AlreadyDestroyed error on repeated destroy() calls (#7686)

* Don't raise `AlreadyDestroyed` error on repeated `destroy()` calls

* Add changelog entry
This commit is contained in:
Andy Leiserson authored and GitHub committed 2025-05-13 09:10:48 +02:00
1 parent f04391d916
commit 0dc6bfdd67
2 files changed
+5 -4

No files matched your search

+4 -4
View File
@@ -713,7 +713,8 @@ impl Buffer {
let raw = match self.raw.snatch(&mut snatch_guard) {
Some(raw) => raw,
None => {
return Err(DestroyError::AlreadyDestroyed);
// Per spec, it is valid to call `destroy` multiple times.
return Ok(());
}
};
@@ -1189,7 +1190,8 @@ impl Texture {
return Ok(());
}
None => {
return Err(DestroyError::AlreadyDestroyed);
// Per spec, it is valid to call `destroy` multiple times.
return Ok(());
}
};
@@ -1953,8 +1955,6 @@ impl QuerySet {
#[derive(Clone, Debug, Error)]
#[non_exhaustive]
pub enum DestroyError {
#[error("Resource is already destroyed")]
AlreadyDestroyed,
#[error(transparent)]
InvalidResource(#[from] InvalidResourceError),
}