From 78248acdcca8336412c49df6933a0f9bcaa255b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 18 Nov 2009 08:54:44 +0000 Subject: [PATCH] The usage of BStatusWindow::HasStatus() was really bogus. First of all HasStatus() and UpdateStatus() were not run in the same lock, so the job view could be gone anyway. And secondly, both methods iterate over all status items to find the one with the correct thread. Doh, if we don't have enough work to do, lets make some! Of course this was not critical in any case... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34104 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/FSUtils.cpp | 9 ++++----- src/kits/tracker/StatusWindow.cpp | 17 ----------------- src/kits/tracker/StatusWindow.h | 3 +-- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/kits/tracker/FSUtils.cpp b/src/kits/tracker/FSUtils.cpp index b81a914ac5..832195650f 100644 --- a/src/kits/tracker/FSUtils.cpp +++ b/src/kits/tracker/FSUtils.cpp @@ -199,9 +199,8 @@ void TrackerCopyLoopControl::UpdateStatus(const char *name, entry_ref, int32 count, bool optional) { - if (gStatusWindow && gStatusWindow->HasStatus(fThread)) - gStatusWindow->UpdateStatus(fThread, const_cast(name), - count, optional); + if (gStatusWindow) + gStatusWindow->UpdateStatus(fThread, name, count, optional); } @@ -817,7 +816,7 @@ MoveTask(BObjectList *srcList, BEntry *destEntry, BList *pointList, u // update the status because item got skipped and the status // will not get updated by the move call - if (gStatusWindow && gStatusWindow->HasStatus(thread)) + if (gStatusWindow) gStatusWindow->UpdateStatus(thread, srcRef->name, 1); continue; @@ -1478,7 +1477,7 @@ MoveItem(BEntry *entry, BDirectory *destDir, BPoint *loc, uint32 moveMode, // size is irrelevant when simply moving to a new folder thread_id thread = find_thread(NULL); - if (gStatusWindow && gStatusWindow->HasStatus(thread)) + if (gStatusWindow) gStatusWindow->UpdateStatus(thread, ref.name, 1); if (entry->IsDirectory()) return RecursiveMove(entry, destDir); diff --git a/src/kits/tracker/StatusWindow.cpp b/src/kits/tracker/StatusWindow.cpp index 41829afb78..8e510932a6 100644 --- a/src/kits/tracker/StatusWindow.cpp +++ b/src/kits/tracker/StatusWindow.cpp @@ -301,23 +301,6 @@ BStatusWindow::RemoveStatusItem(thread_id thread) } -bool -BStatusWindow::HasStatus(thread_id thread) -{ - AutoLock lock(this); - - int32 numItems = fViewList.CountItems(); - for (int32 index = 0; index < numItems; index++) { - BStatusView* view = fViewList.ItemAt(index); - if (view->Thread() == thread) - return true; - - } - - return false; -} - - bool BStatusWindow::CheckCanceledOrPaused(thread_id thread) { diff --git a/src/kits/tracker/StatusWindow.h b/src/kits/tracker/StatusWindow.h index 690f9d08f3..35bcb68c5f 100644 --- a/src/kits/tracker/StatusWindow.h +++ b/src/kits/tracker/StatusWindow.h @@ -77,7 +77,6 @@ public: // will only be updated if 0.2 seconds // elapsed since the last update void RemoveStatusItem(thread_id); - bool HasStatus(thread_id); bool CheckCanceledOrPaused(thread_id); @@ -171,7 +170,7 @@ BStatusView::Thread() const } -extern BStatusWindow *gStatusWindow; +extern BStatusWindow* gStatusWindow; } // namespace BPrivate