lib/dvb/epgcache.cpp: fix crash on timer restart after crash
[vuplus_dvbapp] / lib / dvb / epgcache.cpp
index 15248a6..4d32474 100644 (file)
@@ -234,15 +234,14 @@ eEPGCache::eEPGCache()
 
 void eEPGCache::setCacheFile(const char *path)
 {
-       if (!strlen(m_filename))
+       bool inited = !!strlen(m_filename);
+       strncpy(m_filename, path, 1024);
+       if (!inited)
        {
-               strncpy(m_filename, path, 1024);
                eDebug("[EPGC] setCacheFile read/write epg data from/to '%s'", m_filename);
                if (eDVBLocalTimeHandler::getInstance()->ready())
                        timeUpdated();
        }
-       else
-               eDebug("[EPGC] setCacheFile already called... ignore '%s'", path);
 }
 
 void eEPGCache::timeUpdated()
@@ -259,7 +258,7 @@ void eEPGCache::timeUpdated()
                        {
                                if (it->second->state == -1) {
                                        it->second->state=0;
-                                       messages.send(Message(Message::startChannel, it->second));
+                                       messages.send(Message(Message::startChannel, it->first));
                                }
                        }
                } else
@@ -367,6 +366,8 @@ void eEPGCache::DVBChannelRunning(iDVBChannel *chan)
                                        messages.send(Message(Message::startChannel, chan));
                                        // -> gotMessage -> changedService
                                }
+                               else
+                                       data.state=-1;
                        }
                }
        }
@@ -1188,7 +1189,7 @@ void eEPGCache::save()
 
 eEPGCache::channel_data::channel_data(eEPGCache *ml)
        :cache(ml)
-       ,abortTimer(eTimer::create(ml)), zapTimer(eTimer::create(ml)), state(-1)
+       ,abortTimer(eTimer::create(ml)), zapTimer(eTimer::create(ml)), state(-2)
        ,isRunning(0), haveData(0)
 #ifdef ENABLE_PRIVATE_EPG
        ,startPrivateTimer(eTimer::create(ml))