mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 10:35:29 +03:00
Avoid iterator invalidation segfault when unregistering a syncpt waiter
erase invalidated `it` leading to a potential segfault if the GPU was very far behind, bail out early to avoid that since there can only be one occurence at most in the buffer anyway.
This commit is contained in:
parent
e7bfd93541
commit
95685b8207
@ -29,9 +29,12 @@ namespace skyline::soc::host1x {
|
||||
// We want to ensure the iterator still exists prior to erasing it
|
||||
// Otherwise, if an invalid iterator was passed in then it could lead to UB
|
||||
// It is important to avoid UB in that case since the deregister isn't called from a locked context
|
||||
for (auto it{waiters.begin()}; it != waiters.end(); it++)
|
||||
if (it == waiter)
|
||||
for (auto it{waiters.begin()}; it != waiters.end(); it++) {
|
||||
if (it == waiter) {
|
||||
waiters.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 Syncpoint::Increment() {
|
||||
|
Loading…
Reference in New Issue
Block a user