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:
Dario Casalinuovo
2016-11-14 19:21:58 +01:00
parent 25fa3b1b8a
commit ad7255c892
+9 -3
View File
@@ -119,8 +119,7 @@ public:
~MediaRosterUndertaker()
{
BAutolock _(sInitLocker);
if (BMediaRoster::CurrentRoster() != NULL
&& BMediaRoster::CurrentRoster()->Lock()) {
if (BMediaRoster::CurrentRoster() != NULL) {
// Detect any forgotten node
if (sRegisteredNodes.CountItems() > 0) {
@@ -137,7 +136,14 @@ public:
if (be_app != NULL)
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");
}
}
};