mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
WebContent: Remove pending file requests before invoking their callbacks
It's currently possible for the callback of a file request to request more file objects. This could cause the hash map storing these requests to be rehashed while one of its callbacks is being invoked. AK::Function explicitly forbids this with an assertion. Instead, remove the callback from the hash map before invoking the callback function.
This commit is contained in:
parent
2af7447dfd
commit
7c1fe32af3
1 changed files with 1 additions and 2 deletions
|
@ -562,13 +562,12 @@ Messages::WebContentServer::GetSessionStorageEntriesResponse ConnectionFromClien
|
|||
|
||||
void ConnectionFromClient::handle_file_return(i32 error, Optional<IPC::File> const& file, i32 request_id)
|
||||
{
|
||||
auto file_request = m_requested_files.get(request_id);
|
||||
auto file_request = m_requested_files.take(request_id);
|
||||
|
||||
VERIFY(file_request.has_value());
|
||||
VERIFY(file_request.value().on_file_request_finish);
|
||||
|
||||
file_request.value().on_file_request_finish(error != 0 ? Error::from_errno(error) : ErrorOr<i32> { file->take_fd() });
|
||||
m_requested_files.remove(request_id);
|
||||
}
|
||||
|
||||
void ConnectionFromClient::request_file(Web::FileRequest file_request)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue