wgpu/wgpu-core
Nicolas Silva 1dc5347b14
Better handle destroying textures and buffers (#4657)
* Better handle destroying textures and buffers

Before this commit, explicitly destroying a texture or a buffer (without dropping it)
schedules the asynchronous destruction of its raw resources but does not actually mark
it as destroyed. This can cause some incorrect behavior, for example mapping a buffer
after destroying it does not cause a validation error (and later panics due to the
map callback being dropped without being called).

This Commit adds `Storage::take_and_mark_destroyed` for use in `destroy` methods.
Since it puts the resource in the error state, other methods properly catch that
the resource is no longer usable when attempting to access it and raise validation
errors.

There are other resource types that require similar treatment and will be addressed
in followup work.

* Add a changelog entry
2023-11-09 15:48:06 +01:00
..
src Better handle destroying textures and buffers (#4657) 2023-11-09 15:48:06 +01:00
Cargo.toml Bump raw window handle to 0.6.0 (#4202) 2023-10-27 05:24:46 +00:00
LICENSE.APACHE Add symlink LICENSE files into crates. (#2604) 2022-05-29 03:07:42 -04:00
LICENSE.MIT Add symlink LICENSE files into crates. (#2604) 2022-05-29 03:07:42 -04:00