* Fixed a deadlock that often happened when installing PowerStatus to the

Deskbar.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32259 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-11 18:48:06 +00:00
parent 43d5e9c5d1
commit c52bedd831

View File

@ -100,12 +100,16 @@ PowerStatusDriverInterface::StartWatching(BHandler* target)
status_t
PowerStatusDriverInterface::StopWatching(BHandler* target)
{
BAutolock autolock(fListLocker);
if (fThread < 0)
return B_BAD_VALUE;
if (fWatcherList.CountItems() == 1)
fListLocker.Lock();
if (fWatcherList.CountItems() == 1) {
fListLocker.Unlock();
Disconnect();
} else
fListLocker.Unlock();
return Monitor::StopWatching(target);
}