fixed a possible deadlock when switching to a channel which is not available

This commit is contained in:
louis 2014-01-22 17:43:53 +01:00
parent a65fca41d8
commit 5132a3058a
2 changed files with 20 additions and 15 deletions

View File

@ -499,9 +499,9 @@ void cTvGuideOsd::processKeyYellow() {
} }
} }
eOSState cTvGuideOsd::processKeyBlue() { eOSState cTvGuideOsd::processKeyBlue(bool *alreadyUnlocked) {
if (tvguideConfig.blueKeyMode == eBlueKeySwitch) { if (tvguideConfig.blueKeyMode == eBlueKeySwitch) {
return ChannelSwitch(); return ChannelSwitch(alreadyUnlocked);
} else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) { } else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) {
DetailedEPG(); DetailedEPG();
} else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) { } else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) {
@ -510,22 +510,24 @@ eOSState cTvGuideOsd::processKeyBlue() {
return osContinue; return osContinue;
} }
eOSState cTvGuideOsd::processKeyOk() { eOSState cTvGuideOsd::processKeyOk(bool *alreadyUnlocked) {
if (tvguideConfig.blueKeyMode == eBlueKeySwitch) { if (tvguideConfig.blueKeyMode == eBlueKeySwitch) {
DetailedEPG(); DetailedEPG();
} else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) { } else if (tvguideConfig.blueKeyMode == eBlueKeyEPG) {
return ChannelSwitch(); return ChannelSwitch(alreadyUnlocked);
} else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) { } else if (tvguideConfig.blueKeyMode == eBlueKeyFavorites) {
DetailedEPG(); DetailedEPG();
} }
return osContinue; return osContinue;
} }
eOSState cTvGuideOsd::ChannelSwitch() { eOSState cTvGuideOsd::ChannelSwitch(bool *alreadyUnlocked) {
if (activeGrid == NULL) if (activeGrid == NULL)
return osContinue; return osContinue;
const cChannel *currentChannel = activeGrid->column->getChannel(); const cChannel *currentChannel = activeGrid->column->getChannel();
if (currentChannel) { if (currentChannel) {
cPixmap::Unlock();
*alreadyUnlocked = true;
cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true); cDevice::PrimaryDevice()->SwitchChannel(currentChannel, true);
if (tvguideConfig.closeOnSwitch) { if (tvguideConfig.closeOnSwitch) {
if (detailView) { if (detailView) {
@ -647,6 +649,7 @@ void cTvGuideOsd::SetTimers() {
eOSState cTvGuideOsd::ProcessKey(eKeys Key) { eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
eOSState state = osContinue; eOSState state = osContinue;
cPixmap::Lock(); cPixmap::Lock();
bool alreadyUnlocked = false;
if (recMenuManager->isActive()) { if (recMenuManager->isActive()) {
state = recMenuManager->ProcessKey(Key); state = recMenuManager->ProcessKey(Key);
if (state == osEnd) { if (state == osEnd) {
@ -664,9 +667,9 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
delete detailView; delete detailView;
detailView = NULL; detailView = NULL;
detailViewActive = false; detailViewActive = false;
if ((tvguideConfig.blueKeyMode == eBlueKeySwitch) || (tvguideConfig.blueKeyMode == eBlueKeyFavorites)) if ((tvguideConfig.blueKeyMode == eBlueKeySwitch) || (tvguideConfig.blueKeyMode == eBlueKeyFavorites)) {
state = ChannelSwitch(); state = ChannelSwitch(&alreadyUnlocked);
else { } else {
osdManager.flush(); osdManager.flush();
state = osContinue; state = osContinue;
} }
@ -674,7 +677,7 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
delete detailView; delete detailView;
detailView = NULL; detailView = NULL;
detailViewActive = false; detailViewActive = false;
state = ChannelSwitch(); state = ChannelSwitch(&alreadyUnlocked);
} else { } else {
state = detailView->ProcessKey(Key); state = detailView->ProcessKey(Key);
if (state == osEnd) { if (state == osEnd) {
@ -694,15 +697,17 @@ eOSState cTvGuideOsd::ProcessKey(eKeys Key) {
case kRed: processKeyRed(); break; case kRed: processKeyRed(); break;
case kGreen: processKeyGreen(); break; case kGreen: processKeyGreen(); break;
case kYellow: processKeyYellow(); break; case kYellow: processKeyYellow(); break;
case kBlue: state = processKeyBlue(); break; case kBlue: state = processKeyBlue(&alreadyUnlocked); break;
case kOk: state = processKeyOk(); break; case kOk: state = processKeyOk(&alreadyUnlocked); break;
case kBack: state=osEnd; break; case kBack: state=osEnd; break;
case k0 ... k9: processNumKey(Key - k0); break; case k0 ... k9: processNumKey(Key - k0); break;
case kNone: if (channelJumper) CheckTimeout(); break; case kNone: if (channelJumper) CheckTimeout(); break;
default: break; default: break;
} }
} }
cPixmap::Unlock(); if (!alreadyUnlocked) {
cPixmap::Unlock();
}
return state; return state;
} }

View File

@ -38,8 +38,8 @@ private:
void processKeyRed(); void processKeyRed();
void processKeyGreen(); void processKeyGreen();
void processKeyYellow(); void processKeyYellow();
eOSState processKeyBlue(); eOSState processKeyBlue(bool *alreadyUnlocked);
eOSState processKeyOk(); eOSState processKeyOk(bool *alreadyUnlocked);
void processNumKey(int numKey); void processNumKey(int numKey);
void TimeJump(int mode); void TimeJump(int mode);
void ChannelJump(int num); void ChannelJump(int num);
@ -51,7 +51,7 @@ private:
void timeBack(); void timeBack();
void ScrollForward(); void ScrollForward();
void ScrollBack(); void ScrollBack();
eOSState ChannelSwitch(); eOSState ChannelSwitch(bool *alreadyUnlocked);
void DetailedEPG(); void DetailedEPG();
void SetTimers(); void SetTimers();
void dump(); void dump();