vk: Fix WCB crash

This commit is contained in:
kd-11 2022-02-05 22:26:42 +03:00 committed by kd-11
parent 51f9310b9f
commit a2d33a7d76
1 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@ namespace vk
{
texture_cache::cached_image_reference_t::cached_image_reference_t(texture_cache* parent, std::unique_ptr<vk::viewable_image>& previous)
{
ensure(previous);
this->parent = parent;
this->data = std::move(previous);
}
@ -182,7 +184,7 @@ namespace vk
void texture_cache::on_section_destroyed(cached_texture_section& tex)
{
if (tex.is_managed())
if (tex.is_managed() && tex.exists())
{
auto disposable = std::unique_ptr<vk::disposable_t>(new cached_image_reference_t(this, tex.get_texture()));
vk::get_resource_manager()->dispose(disposable);