Skip to content

Commit 349f182

Browse files
authored
[d3d12] Drop resource before free suballocation (#5943)
1 parent 750f72a commit 349f182

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

wgpu-hal/src/dx12/device.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ impl crate::Device for super::Device {
404404
unsafe fn destroy_buffer(&self, mut buffer: super::Buffer) {
405405
// Only happens when it's using the windows_rs feature and there's an allocation
406406
if let Some(alloc) = buffer.allocation.take() {
407+
// Resource should be dropped before free suballocation
408+
drop(buffer);
409+
407410
super::suballocation::free_buffer_allocation(
408411
self,
409412
alloc,
@@ -494,6 +497,9 @@ impl crate::Device for super::Device {
494497

495498
unsafe fn destroy_texture(&self, mut texture: super::Texture) {
496499
if let Some(alloc) = texture.allocation.take() {
500+
// Resource should be dropped before free suballocation
501+
drop(texture);
502+
497503
super::suballocation::free_texture_allocation(
498504
self,
499505
alloc,

0 commit comments

Comments
 (0)