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

View File

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

View File

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