Index: libs/libmythtv/siparser.cpp
===================================================================
--- libs/libmythtv/siparser.cpp	(revision 9454)
+++ libs/libmythtv/siparser.cpp	(working copy)
@@ -57,6 +57,7 @@
     atsc_stream_data(NULL),         dvb_stream_data(NULL),
     // Mutex Locks
     pmap_lock(false),
+    pnum_lock(false),
     // State variables
     ThreadRunning(false),           exitParserThread(false),
     standardChange(false),
@@ -172,21 +173,24 @@
     // for MPEG PAT
     AddPid(MPEG_PAT_PID, 0xFF, TableID::PAT, true, 10 /*bufferFactor*/);
     // for MPEG PMT
-    if (!pnum_pid.empty())
     {
-        uint pnum = 0xFFFFFFFF;
-        if (SI_STANDARD_ATSC == table_standard)
-            pnum = atsc_stream_data->DesiredProgram();
-        if (SI_STANDARD_DVB == table_standard)
-            pnum = dvb_stream_data->DesiredProgram();
+        QMutexLocker lock (&pnum_lock);
+        if (!pnum_pid.empty())
+        {
+            uint pnum = 0xFFFFFFFF;
+            if (SI_STANDARD_ATSC == table_standard)
+                pnum = atsc_stream_data->DesiredProgram();
+            if (SI_STANDARD_DVB == table_standard)
+                pnum = dvb_stream_data->DesiredProgram();
 
-        pnum_pid_map_t::const_iterator it = pnum_pid.begin();
-        for (; it != pnum_pid.end(); ++it)
-        {
-            if (it.key() == pnum)
-                AddPid(*it, 0xFF, TableID::PMT, true, 10 /*bufferFactor*/);
+            pnum_pid_map_t::const_iterator it = pnum_pid.begin();
+            for (; it != pnum_pid.end(); ++it)
+            {
+                if (it.key() == pnum)
+                    AddPid(*it, 0xFF, TableID::PMT, true, 10 /*bufferFactor*/);
+            }
+            //pnum_pid.clear();
         }
-        //pnum_pid.clear();
     }
     // for DVB NIT
     if (SI_STANDARD_DVB == table_standard && need_nit)
@@ -688,20 +692,23 @@
             .arg(pat->Version()).arg(pat->TransportStreamID()));
 
     PrivateTypes.CurrentTransportID = pat->TransportStreamID();
-    pnum_pid.clear();
-    for (uint i = 0; i < pat->ProgramCount(); ++i)
     {
-        // DVB Program 0 in the PAT represents the location of the NIT
-        if (0 == pat->ProgramNumber(i) && SI_STANDARD_ATSC != table_standard)
+        QMutexLocker lock(&pnum_lock);
+        pnum_pid.clear();
+        for (uint i = 0; i < pat->ProgramCount(); ++i)
         {
-            VERBOSE(VB_SIPARSER, LOC + "NIT Present on this transport " +
-                    QString(" on PID 0x%1").arg(NITPID,0,16));
+            // DVB Program 0 in the PAT represents the location of the NIT
+            if (0 == pat->ProgramNumber(i) && SI_STANDARD_ATSC != table_standard)
+            {
+                VERBOSE(VB_SIPARSER, LOC + "NIT Present on this transport " +
+                        QString(" on PID 0x%1").arg(NITPID,0,16));
 
-            NITPID = pat->ProgramPID(i);
-            continue;
+                NITPID = pat->ProgramPID(i);
+                continue;
+            }
+
+            pnum_pid[pat->ProgramNumber(i)] = pat->ProgramPID(i);
         }
-
-        pnum_pid[pat->ProgramNumber(i)] = pat->ProgramPID(i);
     }
 }
 
@@ -728,21 +735,24 @@
 //       to retune to correct transport or send an error tuning the channel
 void SIParser::HandlePMT(uint pnum, const ProgramMapTable *pmt)
 {
-    VERBOSE(VB_SIPARSER, LOC + QString(
-                "PMT pn(%1) version(%2) cnt(%3) pid(0x%4)")
-            .arg(pnum).arg(pmt->Version()).arg(pmt->StreamCount())
-            .arg(pnum_pid[pmt->ProgramNumber()],0,16));
+    {
+        QMutexLocker lock(&pnum_lock);
+        VERBOSE(VB_SIPARSER, LOC + QString(
+                    "PMT pn(%1) version(%2) cnt(%3) pid(0x%4)")
+                .arg(pnum).arg(pmt->Version()).arg(pmt->StreamCount())
+                .arg(pnum_pid[pmt->ProgramNumber()],0,16));
 
-    if (SI_STANDARD_ATSC == table_standard)
-    {
-        if ((int)pmt->ProgramNumber() == atsc_stream_data->DesiredProgram())
-            emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt);
+        if (SI_STANDARD_ATSC == table_standard)
+        {
+            if ((int)pmt->ProgramNumber() == atsc_stream_data->DesiredProgram())
+                emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt);
+        }
+        if (SI_STANDARD_DVB == table_standard)
+        {
+            if ((int)pmt->ProgramNumber() == dvb_stream_data->DesiredProgram())
+                emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt);
+        }
     }
-    if (SI_STANDARD_DVB == table_standard)
-    {
-        if ((int)pmt->ProgramNumber() == dvb_stream_data->DesiredProgram())
-            emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt);
-    }
 }
 
 /*------------------------------------------------------------------------
Index: libs/libmythtv/siparser.h
===================================================================
--- libs/libmythtv/siparser.h	(revision 9454)
+++ libs/libmythtv/siparser.h	(working copy)
@@ -219,6 +219,7 @@
     // Mutex Locks
     // TODO: Lock Events, and Services, Transports, etc
     QMutex              pmap_lock;
+    QMutex              pnum_lock;
     pnum_pid_map_t      pnum_pid;
     dvb_srv_eit_on_t    dvb_srv_collect_eit;
     atsc_eit_pid_map_t  atsc_eit_pid;
