Revised 'Fixed a possible deadlock when detaching a receiver from a device' from version 2.3.9, which sometimes caused a black screen when switching channels

This commit is contained in:
Klaus Schmidinger 2020-06-12 09:28:44 +02:00
parent 5cfa736ad0
commit 8e1be83b56
3 changed files with 12 additions and 7 deletions

View File

@ -3607,3 +3607,6 @@ J
for reporting a possible discrepancy of the primary device number in the LSTD and for reporting a possible discrepancy of the primary device number in the LSTD and
PRIM commands PRIM commands
for adding support for EAC3 audio from other sources for adding support for EAC3 audio from other sources
Stefan Verse <Verse@amotronics.de>
for fixing an occasional black screen when switching channels

View File

@ -9463,3 +9463,6 @@ Video Disk Recorder Revision History
- Added a device hook for detecting whether a device provides EIT data (thanks to - Added a device hook for detecting whether a device provides EIT data (thanks to
Winfried Köhler). Winfried Köhler).
- Fixed memory handling in cString::Append() (reported by Stefan Herdler). - Fixed memory handling in cString::Append() (reported by Stefan Herdler).
- Revised 'Fixed a possible deadlock when detaching a receiver from a device' from
version 2.3.9, which sometimes caused a black screen when switching channels
(thanks to Stefan Verse).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: device.c 4.31 2020/06/10 14:52:43 kls Exp $ * $Id: device.c 4.32 2020/06/12 09:28:44 kls Exp $
*/ */
#include "device.h" #include "device.h"
@ -1822,17 +1822,16 @@ void cDevice::Detach(cReceiver *Receiver)
bool receiversLeft = false; bool receiversLeft = false;
mutexReceiver.Lock(); mutexReceiver.Lock();
for (int i = 0; i < MAXRECEIVERS; i++) { for (int i = 0; i < MAXRECEIVERS; i++) {
if (receiver[i] == Receiver) { if (receiver[i] == Receiver)
receiver[i] = NULL; receiver[i] = NULL;
Receiver->device = NULL;
Receiver->Activate(false);
for (int n = 0; n < Receiver->numPids; n++)
DelPid(Receiver->pids[n]);
}
else if (receiver[i]) else if (receiver[i])
receiversLeft = true; receiversLeft = true;
} }
mutexReceiver.Unlock(); mutexReceiver.Unlock();
Receiver->device = NULL;
Receiver->Activate(false);
for (int n = 0; n < Receiver->numPids; n++)
DelPid(Receiver->pids[n]);
if (camSlot) { if (camSlot) {
if (Receiver->priority > MINPRIORITY) { // priority check to avoid an infinite loop with the CAM slot's caPidReceiver if (Receiver->priority > MINPRIORITY) { // priority check to avoid an infinite loop with the CAM slot's caPidReceiver
camSlot->StartDecrypting(); camSlot->StartDecrypting();