diff options
| author | 2022-10-06 20:59:40 +0200 | |
|---|---|---|
| committer | 2022-10-06 21:00:54 +0200 | |
| commit | df6dffa30baefd9f1e73399c632ab4e5f6475bab (patch) | |
| tree | 14803b31b6817294d40d57446f6fa94c5ff3fe9a /src/video_core/vulkan_common | |
| parent | maxwell_dma: remove warnings from implemented functionality (diff) | |
| download | yuzu-df6dffa30baefd9f1e73399c632ab4e5f6475bab.tar.gz yuzu-df6dffa30baefd9f1e73399c632ab4e5f6475bab.tar.xz yuzu-df6dffa30baefd9f1e73399c632ab4e5f6475bab.zip | |
vulkan_blitter: Fix pool allocation double free.
Diffstat (limited to 'src/video_core/vulkan_common')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_wrapper.h | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.h index 795f16bfb..1b3f493bd 100644 --- a/src/video_core/vulkan_common/vulkan_wrapper.h +++ b/src/video_core/vulkan_common/vulkan_wrapper.h | |||
| @@ -519,9 +519,7 @@ public: | |||
| 519 | dld{rhs.dld} {} | 519 | dld{rhs.dld} {} |
| 520 | 520 | ||
| 521 | /// Assign an allocation transfering ownership from another allocation. | 521 | /// Assign an allocation transfering ownership from another allocation. |
| 522 | /// Releases any previously held allocation. | ||
| 523 | PoolAllocations& operator=(PoolAllocations&& rhs) noexcept { | 522 | PoolAllocations& operator=(PoolAllocations&& rhs) noexcept { |
| 524 | Release(); | ||
| 525 | allocations = std::move(rhs.allocations); | 523 | allocations = std::move(rhs.allocations); |
| 526 | num = rhs.num; | 524 | num = rhs.num; |
| 527 | device = rhs.device; | 525 | device = rhs.device; |
| @@ -530,11 +528,6 @@ public: | |||
| 530 | return *this; | 528 | return *this; |
| 531 | } | 529 | } |
| 532 | 530 | ||
| 533 | /// Destroys any held allocation. | ||
| 534 | ~PoolAllocations() { | ||
| 535 | Release(); | ||
| 536 | } | ||
| 537 | |||
| 538 | /// Returns the number of allocations. | 531 | /// Returns the number of allocations. |
| 539 | std::size_t size() const noexcept { | 532 | std::size_t size() const noexcept { |
| 540 | return num; | 533 | return num; |
| @@ -557,19 +550,6 @@ public: | |||
| 557 | } | 550 | } |
| 558 | 551 | ||
| 559 | private: | 552 | private: |
| 560 | /// Destroys the held allocations if they exist. | ||
| 561 | void Release() noexcept { | ||
| 562 | if (!allocations) { | ||
| 563 | return; | ||
| 564 | } | ||
| 565 | const Span<AllocationType> span(allocations.get(), num); | ||
| 566 | const VkResult result = Free(device, pool, span, *dld); | ||
| 567 | // There's no way to report errors from a destructor. | ||
| 568 | if (result != VK_SUCCESS) { | ||
| 569 | std::terminate(); | ||
| 570 | } | ||
| 571 | } | ||
| 572 | |||
| 573 | std::unique_ptr<AllocationType[]> allocations; | 553 | std::unique_ptr<AllocationType[]> allocations; |
| 574 | std::size_t num = 0; | 554 | std::size_t num = 0; |
| 575 | VkDevice device = nullptr; | 555 | VkDevice device = nullptr; |