Giovanni Mascellani (@giomasce) commented about libs/vkd3d/resource.c:
else VK_CALL(vkDestroyImage(device->vk_device, resource->u.vk_image, NULL));
- if (resource->flags & VKD3D_RESOURCE_DEDICATED_HEAP) - d3d12_heap_destroy(resource->heap); + if (resource->heap) + d3d12_heap_decref(resource->heap);
Unless I am missing something, this doesn't look correct. For example, `d3d12_committed_resource_create()` assigns `resource->heap` (inside `vkd3d_allocate_resource_memory()`), but doesn't increment its reference count. So either that's wrong, or it's wrong here to decrement indiscriminately. Even in `d3d12_placed_resource_create()` I'd suggest to call `d3d12_heap_incref()` close to where `resource->heap` is actually assigned, so that it's easier to check that assignments and increments are correctly paired (even if control flow might change in the future). -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/127#note_27151