small refcounting fixes, add private operator delete to iObject
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 30 Oct 2008 00:14:17 +0000 (00:14 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 30 Oct 2008 00:14:17 +0000 (00:14 +0000)
lib/base/ebase.h
lib/base/object.h
lib/dvb/dvbtime.cpp
lib/dvb/dvbtime.h
lib/dvb/pmt.cpp
lib/dvb/pmt.h
lib/gdi/font.cpp

index c86c177..84845a9 100644 (file)
@@ -155,7 +155,6 @@ private:
        int requested;          // requested events (POLLIN, ...)
        void activate(int what) { /*emit*/ activated(what); }
        eSocketNotifier(eMainloop *context, int fd, int req, bool startnow);
-       void operator delete(void *pmem) { ::operator delete(pmem); }
 public:
        /**
         * \brief Constructs a eSocketNotifier.
@@ -281,7 +280,6 @@ class eTimer: iObject
        void activate();
 
        eTimer(eMainloop *context): context(*context), bActive(false) { }
-       void operator delete(void *pmem) { ::operator delete(pmem); }
 public:
        /**
         * \brief Constructs a timer.
index f0e0e9a..a3268d4 100644 (file)
@@ -17,6 +17,7 @@ private:
                /* we don't allow the default operator here, as it would break the refcount. */
        void operator=(const iObject &);
 protected:
+       void operator delete(void *p) { ::operator delete(p); }
        virtual ~iObject() { }
 #ifdef SWIG
        virtual void AddRef()=0;
index 4c5911c..83ca335 100644 (file)
@@ -169,8 +169,6 @@ eDVBLocalTimeHandler::eDVBLocalTimeHandler()
 eDVBLocalTimeHandler::~eDVBLocalTimeHandler()
 {
        instance=0;
-       for (std::map<iDVBChannel*, channel_data>::iterator it=m_knownChannels.begin(); it != m_knownChannels.end(); ++it)
-               delete it->second.tdt;
        if (ready())
        {
                eDebug("set RTC to previous valid time");
@@ -396,10 +394,8 @@ void eDVBLocalTimeHandler::updateTime( time_t tp_time, eDVBChannel *chan, int up
                        m_knownChannels.find(chan);
                if ( it != m_knownChannels.end() )
                {
-                       TDT *prev_tdt = it->second.tdt;
-                       it->second.tdt = new TDT(chan, prev_tdt->getUpdateCount());
+                       it->second.tdt = new TDT(chan, it->second.tdt->getUpdateCount());
                        it->second.tdt->startTimer(60*60*1000);  // restart TDT for this transponder in 60min
-                       delete prev_tdt;
                }
        }
 }
@@ -437,7 +433,6 @@ void eDVBLocalTimeHandler::DVBChannelStateChanged(iDVBChannel *chan)
                                        break;
                                case iDVBChannel::state_release:
                                        eDebug("[eDVBLocalTimerHandler] remove channel %p", chan);
-                                       delete it->second.tdt;
                                        m_knownChannels.erase(it);
                                        break;
                                default: // ignore all other events
index efb8596..f403ffd 100644 (file)
@@ -49,7 +49,7 @@ class eDVBLocalTimeHandler: public Object
        DECLARE_REF(eDVBLocalTimeHandler);
        struct channel_data
        {
-               TDT *tdt;
+               ePtr<TDT> tdt;
                ePtr<eDVBChannel> channel;
                ePtr<eConnection> m_stateChangedConn;
                int m_prevChannelState;
index 80fbcab..6082bf4 100644 (file)
@@ -605,7 +605,6 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
 
                        if (ref.path.empty())
                        {
-                               delete m_dvb_scan;
                                m_dvb_scan = new eDVBScan(m_channel, true, false);
                                m_dvb_scan->connectEvent(slot(*this, &eDVBServicePMTHandler::SDTScanEvent), m_scan_event_connection);
                        }
@@ -631,7 +630,6 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
 void eDVBServicePMTHandler::free()
 {
        m_dvb_scan = 0;
-       delete m_dvb_scan;
 
        if (m_ca_servicePtr)
        {
index d3a7faa..107b071 100644 (file)
@@ -76,7 +76,7 @@ class eDVBServicePMTHandler: public Object
 
        int m_last_channel_state;
        eDVBCAService *m_ca_servicePtr;
-       eDVBScan *m_dvb_scan; // for sdt scan
+       ePtr<eDVBScan> m_dvb_scan; // for sdt scan
 
        eAUTable<eTable<ProgramMapSection> > m_PMT;
        eAUTable<eTable<ProgramAssociationSection> > m_PAT;
index 09154de..450269f 100644 (file)
@@ -212,7 +212,6 @@ float fontRenderClass::getLineHeight(const gFont& font)
        if (FTC_Manager_Lookup_Size(cacheManager, &fnt->font.font, &current_face, &fnt->size)<0)
 #endif
        {
-               delete fnt;
                eDebug("FTC_Manager_Lookup_Size failed!");
                return 0;
        }