mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Clear circular download reference when download finished
This commit is contained in:
parent
084c296362
commit
a4b3eb6b2d
Notes:
sideshowbarker
2024-07-19 00:17:57 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/a4b3eb6b2d2 Pull-request: https://github.com/SerenityOS/serenity/pull/4695 Reviewed-by: https://github.com/alimpfard
1 changed files with 4 additions and 1 deletions
|
@ -184,7 +184,10 @@ void ResourceLoader::load(const LoadRequest& request, Function<void(ReadonlyByte
|
|||
error_callback("HTTP load failed");
|
||||
return;
|
||||
}
|
||||
deferred_invoke([&](auto&) { const_cast<RefPtr<Protocol::Download>&>(download) = nullptr; });
|
||||
deferred_invoke([download](auto&) {
|
||||
// Clear circular reference of `download` captured by copy
|
||||
const_cast<Protocol::Download&>(*download).on_buffered_download_finish = nullptr;
|
||||
});
|
||||
success_callback(payload, response_headers);
|
||||
};
|
||||
download->set_should_buffer_all_input(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue