summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2022-10-12 12:34:22 -0700
committerGravatar GitHub2022-10-12 12:34:22 -0700
commit77177a7e33cc42e883f8599aa1c8e3dbdd4f3767 (patch)
tree45c8290187a09e1b5a4f51687fd7e63e8500a1d6 /src
parentMerge pull request #9048 from Kelebek1/regs (diff)
parentsyncpoint_manager: ensure handle is removable before removing (diff)
downloadyuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.gz
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.tar.xz
yuzu-77177a7e33cc42e883f8599aa1c8e3dbdd4f3767.zip
Merge pull request #9049 from liamwhite/monkeyhawk
syncpoint_manager: ensure handle is removable before removing
Diffstat (limited to '')
-rw-r--r--src/video_core/host1x/syncpoint_manager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp
index 326e8355a..a44fc83d3 100644
--- a/src/video_core/host1x/syncpoint_manager.cpp
+++ b/src/video_core/host1x/syncpoint_manager.cpp
@@ -36,7 +36,17 @@ SyncpointManager::ActionHandle SyncpointManager::RegisterAction(
36void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage, 36void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage,
37 ActionHandle& handle) { 37 ActionHandle& handle) {
38 std::unique_lock lk(guard); 38 std::unique_lock lk(guard);
39 action_storage.erase(handle); 39
40 // We want to ensure the iterator still exists prior to erasing it
41 // Otherwise, if an invalid iterator was passed in then it could lead to UB
42 // It is important to avoid UB in that case since the deregister isn't called from a locked
43 // context
44 for (auto it = action_storage.begin(); it != action_storage.end(); it++) {
45 if (it == handle) {
46 action_storage.erase(it);
47 return;
48 }
49 }
40} 50}
41 51
42void SyncpointManager::DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle) { 52void SyncpointManager::DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle) {