* Move the LockLooper() call before PathHandler::Quit() into Quit().

* The B_QUIT_REQUESTED message never arrived for me unless I unlock the
  BLooper again, then it works as expected.
* The B_QUIT_REQUESTED handling accessed fOwnsLooper after deleting the
  object.
(Review much welcome - I don't understand the purpose of locking the BLooper
at all before trying to use a BMessenger to send it a message.)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26805 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-08-04 21:16:11 +00:00
parent 5c78f79f3a
commit a9ab16e27c

View File

@ -212,8 +212,13 @@ PathHandler::InitCheck() const
void
PathHandler::Quit()
{
if (!LockLooper())
return;
BMessenger me(this);
me.SendMessage(B_QUIT_REQUESTED);
UnlockLooper();
}
@ -484,13 +489,16 @@ PathHandler::MessageReceived(BMessage* message)
case B_QUIT_REQUESTED:
{
BLooper* looper = Looper();
bool ownsLooper = fOwnsLooper;
stop_watching(this);
looper->RemoveHandler(this);
delete this;
if (fOwnsLooper)
if (ownsLooper) {
looper->Lock();
looper->Quit();
}
return;
}
@ -833,8 +841,7 @@ BPathMonitor::StopWatching(const char* path, BMessenger target)
PathHandler* handler = i->second;
watcher->handlers.erase(i);
if (handler->LockLooper())
handler->Quit();
handler->Quit();
if (watcher->handlers.empty()) {
sWatchers.erase(iterator);
@ -863,8 +870,7 @@ BPathMonitor::StopWatching(BMessenger target)
PathHandler* handler = i->second;
watcher->handlers.erase(i);
if (handler->LockLooper())
handler->Quit();
handler->Quit();
}
sWatchers.erase(iterator);