mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +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: a4b3eb6b2d
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");
|
error_callback("HTTP load failed");
|
||||||
return;
|
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);
|
success_callback(payload, response_headers);
|
||||||
};
|
};
|
||||||
download->set_should_buffer_all_input(true);
|
download->set_should_buffer_all_input(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue