Ticket #7132: hdpvr-deadlock-fix

File hdpvr-deadlock-fix, 1.3 KB (added by jst-myth@…, 15 years ago)

Deadlock fix.

Line 
1diff -r e0845ebecb46 mythtv/libs/libmythtv/mpegrecorder.cpp
2--- a/mythtv/libs/libmythtv/mpegrecorder.cpp    Mon Sep 21 00:28:38 2009 -0700
3+++ b/mythtv/libs/libmythtv/mpegrecorder.cpp    Tue Sep 22 21:08:09 2009 -0700
4@@ -1086,9 +1086,6 @@ void MpegRecorder::StartRecording(void)
5         if (requires_special_pause && !StartEncoding(readfd))
6         {
7             VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to start recording");
8-            recording = false;
9-            QMutexLocker locker(&recording_wait_lock);
10-            recording_wait.wakeAll();
11             _error = true;
12         }
13         else
14@@ -1120,7 +1117,10 @@ void MpegRecorder::StartRecording(void)
15                 if (!Open())
16                 {
17                     _error = true;
18-                    return;
19+                    // Break out of the loop here rather than return
20+                    // to let the cleanup at the end of this method
21+                    // run (to prevent leaking buffer).
22+                    break;
23                 }
24 
25                 if (readfd < 0)
26@@ -1258,6 +1258,7 @@ void MpegRecorder::StartRecording(void)
27 
28     delete[] buffer;
29     SetStreamData(NULL);
30+    encoding = false;
31     recording = false;
32     QMutexLocker locker(&recording_wait_lock);
33     recording_wait.wakeAll();