|
@@ -720,12 +720,16 @@ bool FileSystemModel::fetch_thumbnail_for(Node const& node)
|
|
};
|
|
};
|
|
|
|
|
|
auto const on_error = [path](Error error) -> void {
|
|
auto const on_error = [path](Error error) -> void {
|
|
- s_thumbnail_cache.with_locked([path, error = move(error)](auto& cache) {
|
|
|
|
- if (error != Error::from_errno(ECANCELED)) {
|
|
|
|
- cache.thumbnail_cache.set(path, nullptr);
|
|
|
|
- dbgln("Failed to load thumbnail for {}: {}", path, error);
|
|
|
|
- }
|
|
|
|
- cache.loading_thumbnails.remove(path);
|
|
|
|
|
|
+ // 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([&] {
|
|
|
|
+ s_thumbnail_cache.with_locked([path, error = move(error)](auto& cache) {
|
|
|
|
+ if (error != Error::from_errno(ECANCELED)) {
|
|
|
|
+ cache.thumbnail_cache.set(path, nullptr);
|
|
|
|
+ dbgln("Failed to load thumbnail for {}: {}", path, error);
|
|
|
|
+ }
|
|
|
|
+ cache.loading_thumbnails.remove(path);
|
|
|
|
+ });
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|