This patch removes stops the signal monitor thread from always running.
It now only runs for scanwizard. There are a few other fixes in there as
well, but hopefully this will cure Ed's segvs.

-- 
John Pullan <[EMAIL PROTECTED]>
        
Index: dvbchannel.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbchannel.cpp,v
retrieving revision 1.32
diff -u -r1.32 dvbchannel.cpp
--- dvbchannel.cpp	23 Feb 2005 05:04:36 -0000	1.32
+++ dvbchannel.cpp	24 Feb 2005 22:40:02 -0000
@@ -99,12 +99,7 @@
     VERBOSE(VB_ALL, "Closing DVB channel");
     if (fd_frontend >= 0)
     {
-        if (monitor)
-        {
-            monitor->Stop();
-            delete monitor;
-            monitor = NULL;
-        }
+        StopMonitor();
 
         close(fd_frontend);
         fd_frontend = -1;
@@ -127,6 +122,22 @@
     }
 }
 
+void DVBChannel::StopMonitor()
+{
+    if (monitor)
+    {
+        monitor->Stop();
+        delete monitor;
+        monitor = NULL;
+    }
+}
+
+void DVBChannel::StartMonitor()
+{
+    monitor = new DVBSignalMonitor(cardnum, fd_frontend);
+    monitor->Start();
+}
+
 void DVBChannel::StopTuning()
 {
     stopTuning = true;
@@ -184,9 +195,6 @@
     
     dvbcam->Start();
 
-    monitor = new DVBSignalMonitor(cardnum, fd_frontend);
-    monitor->Start();
-
     force_channel_change = true;
     first_tune = true;
 
Index: dvbchannel.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbchannel.h,v
retrieving revision 1.18
diff -u -r1.18 dvbchannel.h
--- dvbchannel.h	23 Feb 2005 19:39:19 -0000	1.18
+++ dvbchannel.h	24 Feb 2005 22:40:02 -0000
@@ -80,6 +80,9 @@
 
     void SetCAPMT(PMTObject pmt);
 
+    void StartMonitor();
+    void StopMonitor();
+
     DVBSIParser*        siparser;
     DVBSignalMonitor*   monitor;
 
Index: dvbsignalmonitor.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbsignalmonitor.cpp,v
retrieving revision 1.2
diff -u -r1.2 dvbsignalmonitor.cpp
--- dvbsignalmonitor.cpp	23 Feb 2005 05:04:36 -0000	1.2
+++ dvbsignalmonitor.cpp	24 Feb 2005 22:40:03 -0000
@@ -1,3 +1,4 @@
+#include <unistd.h>
 #include "mythcontext.h"
 #include "mythdbcon.h"
 #include "dvbsignalmonitor.h"
@@ -10,7 +11,10 @@
     cardnum(_cardnum), fd_frontend(_fd_frontend)
 {
     running = false;
+    exit = false;
 
+    if (fd_frontend >=0)
+       fd_frontend = dup(fd_frontend);
     //signal_monitor_interval = 0;
     //expire_data_days = 3;
 }
@@ -42,7 +46,7 @@
 
     GENERAL("DVB Signal Monitor Starting");
 
-    while (!exit)
+    while (!exit && (fd_frontend >= 0))
     {
         if (FillFrontendStats(stats))
         {
@@ -83,6 +87,8 @@
 
         usleep(250 * 1000);
     }
+    if (fd_frontend>=0)
+       close(fd_frontend);
 
     running = false;
     GENERAL("DVB Signal Monitor Stopped");
Index: dvbsignalmonitor.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbsignalmonitor.h,v
retrieving revision 1.1
diff -u -r1.1 dvbsignalmonitor.h
--- dvbsignalmonitor.h	23 Jan 2005 22:45:30 -0000	1.1
+++ dvbsignalmonitor.h	24 Feb 2005 22:40:03 -0000
@@ -19,7 +19,7 @@
 
 signals:
     void Status(dvb_stats_t &stats);
-    void Status(QString val);
+    void Status(const QString& val);
 
     void StatusSignalToNoise(int);
     void StatusSignalStrength(int);
Index: dvbtypes.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbtypes.h,v
retrieving revision 1.6
diff -u -r1.6 dvbtypes.h
--- dvbtypes.h	23 Jan 2005 22:45:30 -0000	1.6
+++ dvbtypes.h	24 Feb 2005 22:40:03 -0000
@@ -76,8 +76,8 @@
 
 typedef struct dvbstats
 {
-    uint16_t snr;
-    uint16_t ss;
+    uint32_t snr;
+    uint32_t ss;
     uint32_t ber;
     uint32_t ub;
 
Index: scanwizard.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scanwizard.cpp,v
retrieving revision 1.4
diff -u -r1.4 scanwizard.cpp
--- scanwizard.cpp	23 Feb 2005 05:04:36 -0000	1.4
+++ scanwizard.cpp	24 Feb 2005 22:40:04 -0000
@@ -861,7 +861,7 @@
     QApplication::postEvent(this,e);
 }
 
-void ScanWizardScanner::dvbStatus(QString str)
+void ScanWizardScanner::dvbStatus(const QString& str)
 {
     ScannerEvent* e=new ScannerEvent(ScanWizardScanner::ScannerEvent::DVBStatus);
     e->strValue(str);
@@ -965,6 +965,7 @@
     if(!dvbchannel->Open())
        return;
 
+    dvbchannel->StartMonitor();
     scanner = new SIScan(dvbchannel, parent->videoSource());
     
     scanner->SetForceUpdate(true);
@@ -1000,7 +1001,7 @@
             this,SLOT(serviceScanPctComplete(int)));
 
     // Signal Meters Need connecting here
-    connect(dvbchannel->monitor,SIGNAL(Status(QString)),this,SLOT(dvbStatus(QString)));
+    connect(dvbchannel->monitor,SIGNAL(Status(const QString&)),this,SLOT(dvbStatus(const QString&)));
     connect(dvbchannel->monitor,SIGNAL(StatusSignalToNoise(int)),this,SLOT(dvbSNR(int)));
     connect(dvbchannel->monitor,SIGNAL(StatusSignalStrength(int)),this,SLOT(dvbSignalStrength(int)));
 
Index: scanwizard.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/scanwizard.h,v
retrieving revision 1.3
diff -u -r1.3 scanwizard.h
--- scanwizard.h	23 Feb 2005 05:04:36 -0000	1.3
+++ scanwizard.h	24 Feb 2005 22:40:04 -0000
@@ -308,7 +308,7 @@
 
     void TableLoaded();
 
-    void dvbStatus(QString str);
+    void dvbStatus(const QString& str);
     void dvbSNR(int);
     void dvbSignalStrength(int);
 
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to