mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-06-01 12:15:27 -06:00
vk: Avoid use-after-free fence object
This commit is contained in:
parent
e9c3ab7ae6
commit
1c5667f0ce
@ -94,14 +94,16 @@ struct command_buffer_chunk: public vk::command_buffer
|
|||||||
|
|
||||||
bool poke()
|
bool poke()
|
||||||
{
|
{
|
||||||
|
reader_lock lock(guard_mutex);
|
||||||
|
|
||||||
if (vkGetFenceStatus(m_device, submit_fence) == VK_SUCCESS)
|
if (vkGetFenceStatus(m_device, submit_fence) == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
lock.upgrade();
|
||||||
|
|
||||||
if (pending)
|
if (pending)
|
||||||
{
|
{
|
||||||
vk::reset_fence(&submit_fence);
|
|
||||||
pending = false;
|
pending = false;
|
||||||
|
vk::reset_fence(&submit_fence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +112,7 @@ struct command_buffer_chunk: public vk::command_buffer
|
|||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
reader_lock lock(guard_mutex);
|
||||||
|
|
||||||
if (!pending)
|
if (!pending)
|
||||||
return;
|
return;
|
||||||
@ -124,8 +126,13 @@ struct command_buffer_chunk: public vk::command_buffer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::reset_fence(&submit_fence);
|
lock.upgrade();
|
||||||
pending = false;
|
|
||||||
|
if (pending)
|
||||||
|
{
|
||||||
|
vk::reset_fence(&submit_fence);
|
||||||
|
pending = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user