MediaRoster: Use messaging instead to call Quit on exit
* As far as the bebook states loopers shouldn't be quit from other threads, using a B_QUIT_REQUESTED message should be more safe.
This commit is contained in:
@@ -119,8 +119,7 @@ public:
|
|||||||
~MediaRosterUndertaker()
|
~MediaRosterUndertaker()
|
||||||
{
|
{
|
||||||
BAutolock _(sInitLocker);
|
BAutolock _(sInitLocker);
|
||||||
if (BMediaRoster::CurrentRoster() != NULL
|
if (BMediaRoster::CurrentRoster() != NULL) {
|
||||||
&& BMediaRoster::CurrentRoster()->Lock()) {
|
|
||||||
|
|
||||||
// Detect any forgotten node
|
// Detect any forgotten node
|
||||||
if (sRegisteredNodes.CountItems() > 0) {
|
if (sRegisteredNodes.CountItems() > 0) {
|
||||||
@@ -137,7 +136,14 @@ public:
|
|||||||
if (be_app != NULL)
|
if (be_app != NULL)
|
||||||
be_app->UnregisterLooper(BMediaRoster::CurrentRoster());
|
be_app->UnregisterLooper(BMediaRoster::CurrentRoster());
|
||||||
|
|
||||||
BMediaRoster::CurrentRoster()->Quit();
|
status_t err = B_ERROR;
|
||||||
|
thread_id roster = BMediaRoster::CurrentRoster()->Thread();
|
||||||
|
|
||||||
|
BMediaRoster::CurrentRoster()->PostMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
wait_for_thread(roster, &err);
|
||||||
|
if (err != B_OK)
|
||||||
|
ERROR("BMediaRoster: wait_for_thread returned error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user