* 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:
parent
5c78f79f3a
commit
a9ab16e27c
@ -212,8 +212,13 @@ PathHandler::InitCheck() const
|
|||||||
void
|
void
|
||||||
PathHandler::Quit()
|
PathHandler::Quit()
|
||||||
{
|
{
|
||||||
|
if (!LockLooper())
|
||||||
|
return;
|
||||||
|
|
||||||
BMessenger me(this);
|
BMessenger me(this);
|
||||||
me.SendMessage(B_QUIT_REQUESTED);
|
me.SendMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -484,13 +489,16 @@ PathHandler::MessageReceived(BMessage* message)
|
|||||||
case B_QUIT_REQUESTED:
|
case B_QUIT_REQUESTED:
|
||||||
{
|
{
|
||||||
BLooper* looper = Looper();
|
BLooper* looper = Looper();
|
||||||
|
bool ownsLooper = fOwnsLooper;
|
||||||
|
|
||||||
stop_watching(this);
|
stop_watching(this);
|
||||||
looper->RemoveHandler(this);
|
looper->RemoveHandler(this);
|
||||||
delete this;
|
delete this;
|
||||||
|
|
||||||
if (fOwnsLooper)
|
if (ownsLooper) {
|
||||||
|
looper->Lock();
|
||||||
looper->Quit();
|
looper->Quit();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -833,8 +841,7 @@ BPathMonitor::StopWatching(const char* path, BMessenger target)
|
|||||||
PathHandler* handler = i->second;
|
PathHandler* handler = i->second;
|
||||||
watcher->handlers.erase(i);
|
watcher->handlers.erase(i);
|
||||||
|
|
||||||
if (handler->LockLooper())
|
handler->Quit();
|
||||||
handler->Quit();
|
|
||||||
|
|
||||||
if (watcher->handlers.empty()) {
|
if (watcher->handlers.empty()) {
|
||||||
sWatchers.erase(iterator);
|
sWatchers.erase(iterator);
|
||||||
@ -863,8 +870,7 @@ BPathMonitor::StopWatching(BMessenger target)
|
|||||||
PathHandler* handler = i->second;
|
PathHandler* handler = i->second;
|
||||||
watcher->handlers.erase(i);
|
watcher->handlers.erase(i);
|
||||||
|
|
||||||
if (handler->LockLooper())
|
handler->Quit();
|
||||||
handler->Quit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sWatchers.erase(iterator);
|
sWatchers.erase(iterator);
|
||||||
|
Loading…
Reference in New Issue
Block a user