From c52bedd831baa6eb8603bab2dc729e31edf9e1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 11 Aug 2009 18:48:06 +0000 Subject: [PATCH] * 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 --- src/apps/powerstatus/DriverInterface.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apps/powerstatus/DriverInterface.cpp b/src/apps/powerstatus/DriverInterface.cpp index b7f499d493..c10cea9484 100644 --- a/src/apps/powerstatus/DriverInterface.cpp +++ b/src/apps/powerstatus/DriverInterface.cpp @@ -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); }