Tracker: Trash entry must be set, otherwise bad things happen.

Follow up to hrev59580. Preload Trash icon again. We need to
Refresh cache in TrashWatcher::Run(), remove the rest.

Fixes #20026.

Change-Id: Ie39fff508c936819067eed198f5b801de2662ba8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10689
Reviewed-by: John Scipione <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
John Scipione
2026-04-08 22:11:23 +00:00
committed by waddlesplash
parent 757e60f86b
commit 76afa5f534
2 changed files with 11 additions and 5 deletions
-3
View File
@@ -965,9 +965,6 @@ IconCache::Preload(AutoLock<SimpleIconCache>* nodeCacheLocker,
entry = GetPrinterIcon(nodeCacheLocker, sharedCacheLocker,
&resultingOpenCache, model, source, mode, size, &lazyBitmap);
ASSERT(entry != NULL);
} else if (model->IsTrash()) {
// do not preload Trash icon, TrashWatcher handles it.
source = kNode;
} else {
if (source == kUnknownSource) {
// look for node icons first
+11 -2
View File
@@ -47,6 +47,7 @@ All rights reserved.
#include "Attributes.h"
#include "Bitmaps.h"
#include "FSUtils.h"
#include "IconCache.h"
#include "Tracker.h"
@@ -71,8 +72,16 @@ BTrashWatcher::BTrashWatcher()
thread_id
BTrashWatcher::Run()
{
fTrashFull = CheckTrashDirs();
UpdateTrashIcon();
// refresh Trash icon cache
BPath path;
if (find_directory(B_TRASH_DIRECTORY, &path) == B_OK) {
BDirectory trashDir(path.Path());
BEntry entry;
if (trashDir.GetEntry(&entry) == B_OK) {
Model trashModel(&entry);
IconCache::sIconCache->IconChanged(&trashModel);
}
}
return BLooper::Run();
}