mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
okay im bad at copying code
this happened whenever the request would get converted into json and fail, and then that handler would call SentAsyncWebRequest::error instead of the expect, delaying the execution of expect by one frame, by which time the request class was already deleted. Co-Authored-By: dankmeme01 <42031238+dankmeme01@users.noreply.github.com>
This commit is contained in:
parent
49738e6029
commit
c035278231
1 changed files with 8 additions and 8 deletions
|
@ -412,8 +412,12 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
then(*m_self, ret);
|
||||
l.lock();
|
||||
}
|
||||
std::lock_guard __(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
// Delay the destruction of SentAsyncWebRequest till the next frame
|
||||
// otherwise we'd have an use-after-free
|
||||
Loader::get()->queueInMainThread([m_id = m_id] {
|
||||
std::lock_guard __(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
});
|
||||
});
|
||||
}).detach();
|
||||
}
|
||||
|
@ -477,12 +481,8 @@ void SentAsyncWebRequest::Impl::error(std::string const& error, int code) {
|
|||
l.lock();
|
||||
}
|
||||
}
|
||||
// Delay the destruction of SentAsyncWebRequest till the next frame
|
||||
// otherwise we'd have an use-after-free
|
||||
Loader::get()->queueInMainThread([m_id = m_id] {
|
||||
std::lock_guard _(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
});
|
||||
std::lock_guard _(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue