Eliminate deadlock in "DeleteTimer"

This commit is contained in:
kamel5 2018-03-31 15:21:32 +02:00 committed by kamel5
parent d5b3844dcc
commit c6d01ba60b
3 changed files with 19 additions and 3 deletions

View File

@ -178,9 +178,13 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
} }
void cRecManager::DeleteTimer(int timerID) { void cRecManager::DeleteTimer(int timerID) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
const cTimer *t;
{
LOCK_TIMERS_READ; LOCK_TIMERS_READ;
const cTimer *t = Timers->Get(timerID); t = Timers->Get(timerID);
}
#else #else
cTimer *t = Timers.Get(timerID); cTimer *t = Timers.Get(timerID);
#endif #endif
@ -190,6 +194,7 @@ void cRecManager::DeleteTimer(int timerID) {
} }
void cRecManager::DeleteTimer(const cEvent *event) { void cRecManager::DeleteTimer(const cEvent *event) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
if (!event) if (!event)
return; return;
if (tvguideConfig.useRemoteTimers && pRemoteTimers) { if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
@ -200,9 +205,13 @@ void cRecManager::DeleteTimer(const cEvent *event) {
} }
void cRecManager::DeleteLocalTimer(const cEvent *event) { void cRecManager::DeleteLocalTimer(const cEvent *event) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
const cTimer *t;
{
LOCK_TIMERS_READ; LOCK_TIMERS_READ;
const cTimer *t = Timers->GetMatch(event); t = Timers->GetMatch(event);
}
#else #else
cTimer *t = Timers.GetMatch(event); cTimer *t = Timers.GetMatch(event);
#endif #endif
@ -214,6 +223,7 @@ void cRecManager::DeleteLocalTimer(const cEvent *event) {
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
void cRecManager::DeleteTimer(const cTimer *timer) { void cRecManager::DeleteTimer(const cTimer *timer) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
LOCK_TIMERS_WRITE; LOCK_TIMERS_WRITE;
cTimers* timers = Timers; cTimers* timers = Timers;
cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast

View File

@ -141,6 +141,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
case rmsDeleteTimerConflictMenu: { case rmsDeleteTimerConflictMenu: {
//caller: cRecMenuTimerConflict //caller: cRecMenuTimerConflict
//delete timer out of current timer conflict //delete timer out of current timer conflict
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
int timerIndex; int timerIndex;
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) { if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
timerIndex = menu->GetTimerConflictIndex(); timerIndex = menu->GetTimerConflictIndex();
@ -196,6 +197,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
case rmsDeleteTimer: case rmsDeleteTimer:
//caller: main menu //caller: main menu
//delete timer for active event //delete timer for active event
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
delete activeMenu; delete activeMenu;
if (recManager->IsRecorded(event)) { if (recManager->IsRecorded(event)) {
activeMenu = new cRecMenuAskDeleteTimer(event); activeMenu = new cRecMenuAskDeleteTimer(event);
@ -951,4 +953,4 @@ eOSState cRecMenuManager::ProcessKey(eKeys Key) {
} }
osdManager.flush(); osdManager.flush();
return state; return state;
} }

View File

@ -6,11 +6,13 @@
// --- cRecMenuMain --------------------------------------------------------- // --- cRecMenuMain ---------------------------------------------------------
cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) { cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) {
eRecMenuState action = rmsInstantRecord; eRecMenuState action = rmsInstantRecord;
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
if (!timerActive) { if (!timerActive) {
if (tvguideConfig.instRecFolderMode == eFolderSelect) if (tvguideConfig.instRecFolderMode == eFolderSelect)
action = rmsInstantRecordFolder; action = rmsInstantRecordFolder;
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true, false, false, true)); AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true, false, false, true));
} else { } else {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true, false, false, true)); AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true, false, false, true));
AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false, false, false, true)); AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false, false, false, true));
} }
@ -147,6 +149,7 @@ cRecMenuConfirmTimer::cRecMenuConfirmTimer(const cEvent *event) {
// --- cRecMenuConfirmDeleteTimer --------------------------------------------------------- // --- cRecMenuConfirmDeleteTimer ---------------------------------------------------------
cRecMenuConfirmDeleteTimer::cRecMenuConfirmDeleteTimer(const cEvent *event) { cRecMenuConfirmDeleteTimer::cRecMenuConfirmDeleteTimer(const cEvent *event) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
SetWidthPercent(50); SetWidthPercent(50);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
@ -174,6 +177,7 @@ cRecMenuConfirmDeleteTimer::cRecMenuConfirmDeleteTimer(const cEvent *event) {
// --- cRecMenuAskDeleteTimer --------------------------------------------------------- // --- cRecMenuAskDeleteTimer ---------------------------------------------------------
cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) { cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) {
dsyslog ("%s %s %d\n", __FILE__, __func__, __LINE__);
SetWidthPercent(50); SetWidthPercent(50);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;