mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-31 19:21:25 +00: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()
|
||||
{
|
||||
reader_lock lock(guard_mutex);
|
||||
|
||||
if (vkGetFenceStatus(m_device, submit_fence) == VK_SUCCESS)
|
||||
{
|
||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
||||
lock.upgrade();
|
||||
|
||||
if (pending)
|
||||
{
|
||||
vk::reset_fence(&submit_fence);
|
||||
pending = false;
|
||||
vk::reset_fence(&submit_fence);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +112,7 @@ struct command_buffer_chunk: public vk::command_buffer
|
||||
|
||||
void wait()
|
||||
{
|
||||
std::lock_guard<shared_mutex> lock(guard_mutex);
|
||||
reader_lock lock(guard_mutex);
|
||||
|
||||
if (!pending)
|
||||
return;
|
||||
@ -124,8 +126,13 @@ struct command_buffer_chunk: public vk::command_buffer
|
||||
break;
|
||||
}
|
||||
|
||||
vk::reset_fence(&submit_fence);
|
||||
pending = false;
|
||||
lock.upgrade();
|
||||
|
||||
if (pending)
|
||||
{
|
||||
vk::reset_fence(&submit_fence);
|
||||
pending = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user