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
This commit is contained in:
Stephan Aßmus 2009-11-18 08:54:44 +00:00
parent bce3b09aed
commit 78248acdcc
3 changed files with 5 additions and 24 deletions

View File

@ -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<char *>(name),
count, optional);
if (gStatusWindow)
gStatusWindow->UpdateStatus(fThread, name, count, optional);
}
@ -817,7 +816,7 @@ MoveTask(BObjectList<entry_ref> *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);

View File

@ -301,23 +301,6 @@ BStatusWindow::RemoveStatusItem(thread_id thread)
}
bool
BStatusWindow::HasStatus(thread_id thread)
{
AutoLock<BWindow> 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)
{

View File

@ -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