MediaDefs/MediaRoster: Increase code consistency

* Also fix a possible issue with List::Get, the code returned
after a Get() error. While I doubt if this happens the next
items will be still valid, I prefer to continue until we reach
the end of the items, and in case of a SyncToRoster request we will
at least get the list empty. We might have a blocking call
on the other end, so it's our own duty to at least try to avoid
this in any case. As final result at least we will get the list
empty.
This commit is contained in:
Dario Casalinuovo 2016-04-22 13:04:15 +02:00
parent 76889670db
commit e4704eb6f9
2 changed files with 8 additions and 8 deletions

View File

@ -1299,12 +1299,12 @@ shutdown_media_server(bigtime_t timeout,
{
BMessage msg(B_QUIT_REQUESTED);
BMessage reply;
status_t err;
status_t err = B_MEDIA_SYSTEM_FAILURE;
bool shutdown = false;
BMediaRoster* roster = BMediaRoster::Roster();
if (roster == NULL)
return B_ERROR;
BMediaRoster* roster = BMediaRoster::Roster(&err);
if (roster == NULL || err != B_OK)
return err;
if (progress == NULL && roster->Lock()) {
MediaRosterEx(roster)->EnableLaunchNotification(true, true);

View File

@ -3555,10 +3555,10 @@ BMediaRoster::MessageReceived(BMessage* message)
BMessage reply;
for (int32 i = 0; i < sSyncedMessages.CountItems(); i++) {
SyncedMessage* msg;
if (sSyncedMessages.Get(i, &msg) != true)
return;
msg->message->SendReply(&reply);
delete msg->message;
if (sSyncedMessages.Get(i, &msg) == true) {
msg->message->SendReply(&reply);
delete msg->message;
}
sSyncedMessages.Remove(i);
}