summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2020-06-12 09:28:44 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2020-06-12 09:28:44 +0200
commit8e1be83b56ee9570edce459a35e60201740f4779 (patch)
tree730c16223305476bd45c7ffe1855d4181704d066 /device.c
parent5cfa736ad08cb37cd60a09752cd7df997f2370f8 (diff)
downloadvdr-8e1be83b56ee9570edce459a35e60201740f4779.tar.gz
vdr-8e1be83b56ee9570edce459a35e60201740f4779.tar.bz2
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
Diffstat (limited to 'device.c')
-rw-r--r--device.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/device.c b/device.c
index d1bbbd07..e539d486 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -1822,17 +1822,16 @@ void cDevice::Detach(cReceiver *Receiver)
bool receiversLeft = false;
mutexReceiver.Lock();
for (int i = 0; i < MAXRECEIVERS; i++) {
- if (receiver[i] == Receiver) {
+ if (receiver[i] == Receiver)
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])
receiversLeft = true;
}
mutexReceiver.Unlock();
+ Receiver->device = NULL;
+ Receiver->Activate(false);
+ for (int n = 0; n < Receiver->numPids; n++)
+ DelPid(Receiver->pids[n]);
if (camSlot) {
if (Receiver->priority > MINPRIORITY) { // priority check to avoid an infinite loop with the CAM slot's caPidReceiver
camSlot->StartDecrypting();