mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibGUI: Resolve use-after-free error
Objects taken by reference are no longer valid when used in `deferred_invoke`. Explicitly copying them solve the issue.
This commit is contained in:
parent
2a410f8985
commit
a9cc61224d
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/LucasChollet
Commit: a9cc61224d
Pull-request: https://github.com/SerenityOS/serenity/pull/17980
1 changed files with 1 additions and 1 deletions
|
@ -729,7 +729,7 @@ bool FileSystemModel::fetch_thumbnail_for(Node const& node)
|
|||
auto const on_error = [path, update_progress](Error error) -> void {
|
||||
// Note: We need to defer that to avoid the function removing its last reference
|
||||
// i.e. trying to destroy itself, which is prohibited.
|
||||
Core::EventLoop::current().deferred_invoke([&] {
|
||||
Core::EventLoop::current().deferred_invoke([path, error = Error::copy(error)]() mutable {
|
||||
s_thumbnail_cache.with_locked([path, error = move(error)](auto& cache) {
|
||||
if (error != Error::from_errno(ECANCELED)) {
|
||||
cache.thumbnail_cache.set(path, nullptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue