lr: fix EraseRedirection hang introduced by refactoring

This commit is contained in:
Michael Scire 2021-10-18 11:00:55 -07:00
parent 889d843718
commit 799a9a5f98

View file

@ -86,25 +86,27 @@ namespace ams::lr {
void LocationRedirector::EraseRedirection(ncm::ProgramId program_id) { void LocationRedirector::EraseRedirection(ncm::ProgramId program_id) {
/* Remove any redirections with a matching program id. */ /* Remove any redirections with a matching program id. */
for (auto it = m_redirection_list.begin(); it != m_redirection_list.end();) { for (auto it = m_redirection_list.begin(); it != m_redirection_list.end(); /* ... */) {
if (it->GetProgramId() == program_id) { if (it->GetProgramId() == program_id) {
auto *redirection = std::addressof(*it); auto *redirection = std::addressof(*it);
m_redirection_list.erase(it); it = m_redirection_list.erase(it);
delete redirection; delete redirection;
break; break;
} else {
++it;
} }
} }
} }
void LocationRedirector::ClearRedirections(u32 flags) { void LocationRedirector::ClearRedirections(u32 flags) {
/* Remove any redirections with matching flags. */ /* Remove any redirections with matching flags. */
for (auto it = m_redirection_list.begin(); it != m_redirection_list.end();) { for (auto it = m_redirection_list.begin(); it != m_redirection_list.end(); /* ... */) {
if ((it->GetFlags() & flags) == flags) { if ((it->GetFlags() & flags) == flags) {
auto *redirection = std::addressof(*it); auto *redirection = std::addressof(*it);
it = m_redirection_list.erase(it); it = m_redirection_list.erase(it);
delete redirection; delete redirection;
} else { } else {
it++; ++it;
} }
} }
} }