fix segfault on fast zapping (faster then a pmt is received)
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 24 May 2006 13:17:36 +0000 (13:17 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 24 May 2006 13:17:36 +0000 (13:17 +0000)
lib/dvb/pmt.cpp

index 16f9368..5301df9 100644 (file)
@@ -449,7 +449,8 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
                ref.getChannelID(chid);
                res = m_resourceManager->allocateChannel(chid, m_channel);
                eDebug("allocate Channel: res %d", res);
-               eDVBCIInterfaces::getInstance()->addPMTHandler(this);
+               if (!res)
+                       eDVBCIInterfaces::getInstance()->addPMTHandler(this);
        } else
        {
                eDVBMetaParser parser;
@@ -537,10 +538,12 @@ void eDVBServicePMTHandler::free()
                ePtr<eTable<ProgramMapSection> > ptr;
                m_PMT.getCurrent(ptr);
                eDVBCAService::unregister_service(m_reference, demuxes, ptr);
-               eDVBCIInterfaces::getInstance()->removePMTHandler(this);
                m_ca_servicePtr = 0;
        }
 
+       if (m_channel)
+               eDVBCIInterfaces::getInstance()->removePMTHandler(this);
+
        if (m_pvr_channel)
        {
                m_pvr_channel->stopFile();