mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 03:48:13 +00:00
LibWeb: Clear circular download reference when download finished
This commit is contained in:
parent
084c296362
commit
a4b3eb6b2d
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