From 8e1be83b56ee9570edce459a35e60201740f4779 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 12 Jun 2020 09:28:44 +0200 Subject: 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 --- CONTRIBUTORS | 3 +++ HISTORY | 3 +++ device.c | 13 ++++++------- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ae420977..39888235 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3607,3 +3607,6 @@ J for reporting a possible discrepancy of the primary device number in the LSTD and PRIM commands for adding support for EAC3 audio from other sources + +Stefan Verse + for fixing an occasional black screen when switching channels diff --git a/HISTORY b/HISTORY index 58816ebe..54f63c99 100644 --- a/HISTORY +++ b/HISTORY @@ -9463,3 +9463,6 @@ Video Disk Recorder Revision History - Added a device hook for detecting whether a device provides EIT data (thanks to Winfried Köhler). - 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). 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(); -- cgit v1.2.3