diff options
author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2008-10-29 19:46:57 (GMT) |
---|---|---|
committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2008-10-29 19:46:57 (GMT) |
commit | 10e7e45ae92d4fe06f70126ed256b87896dbc432 (patch) | |
tree | f4b03eb252e5517ccb67be3cd8463c10e14e147c /lib/dvb | |
parent | 6bb94cd5b0d8fd3608afe84e8d76aef554a4b401 (diff) |
better solution to add possibility to delete eSocketNotifiers,
eConsoleAppContainers in callback funktions without crash
Diffstat (limited to 'lib/dvb')
-rw-r--r-- | lib/dvb/decoder.cpp | 4 | ||||
-rw-r--r-- | lib/dvb/decoder.h | 2 | ||||
-rw-r--r-- | lib/dvb/demux.cpp | 8 | ||||
-rw-r--r-- | lib/dvb/demux.h | 4 | ||||
-rw-r--r-- | lib/dvb/frontend.cpp | 5 | ||||
-rw-r--r-- | lib/dvb/frontend.h | 2 | ||||
-rw-r--r-- | lib/dvb/pmt.cpp | 10 | ||||
-rw-r--r-- | lib/dvb/pmt.h | 2 |
8 files changed, 13 insertions, 24 deletions
diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index 57f48ee..c550163 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -315,7 +315,7 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev) eWarning("%s: %m", filename); else { - m_sn = new eSocketNotifier(eApp, m_fd, eSocketNotifier::Priority); + m_sn = eSocketNotifier::create(eApp, m_fd, eSocketNotifier::Priority); CONNECT(m_sn->activated, eDVBVideo::video_event); } eDebug("Video Device: %s", filename); @@ -527,8 +527,6 @@ int eDVBVideo::getPTS(pts_t &now) eDVBVideo::~eDVBVideo() { - if (m_sn) - delete m_sn; if (m_is_slow_motion) setSlowMotion(0); if (m_is_fast_forward) diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index 7dfe383..a652e09 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -44,7 +44,7 @@ private: m_fd_video; #endif int m_is_slow_motion, m_is_fast_forward, m_is_freezed; - eSocketNotifier *m_sn; + ePtr<eSocketNotifier> m_sn; void video_event(int what); Signal1<void, struct iTSMPEGDecoder::videoEvent> m_event; public: diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp index 29bbf26..a0f1c32 100644 --- a/lib/dvb/demux.cpp +++ b/lib/dvb/demux.cpp @@ -206,7 +206,7 @@ eDVBSectionReader::eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESUL if (fd >= 0) { - notifier=new eSocketNotifier(context, fd, eSocketNotifier::Read, false); + notifier=eSocketNotifier::create(context, fd, eSocketNotifier::Read, false); CONNECT(notifier->activated, eDVBSectionReader::data); res = 0; } else @@ -220,8 +220,6 @@ DEFINE_REF(eDVBSectionReader) eDVBSectionReader::~eDVBSectionReader() { - if (notifier) - delete notifier; if (fd >= 0) ::close(fd); } @@ -331,7 +329,7 @@ eDVBPESReader::eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res): { ::ioctl(m_fd, DMX_SET_BUFFER_SIZE, 64*1024); ::fcntl(m_fd, F_SETFL, O_NONBLOCK); - m_notifier = new eSocketNotifier(context, m_fd, eSocketNotifier::Read, false); + m_notifier = eSocketNotifier::create(context, m_fd, eSocketNotifier::Read, false); CONNECT(m_notifier->activated, eDVBPESReader::data); res = 0; } else @@ -345,8 +343,6 @@ DEFINE_REF(eDVBPESReader) eDVBPESReader::~eDVBPESReader() { - if (m_notifier) - delete m_notifier; if (m_fd >= 0) ::close(m_fd); } diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index 1c0da47..1a7db97 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -54,7 +54,7 @@ class eDVBSectionReader: public iDVBSectionReader, public Object int active; int checkcrc; void data(int); - eSocketNotifier *notifier; + ePtr<eSocketNotifier> notifier; public: eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res); @@ -72,7 +72,7 @@ class eDVBPESReader: public iDVBPESReader, public Object ePtr<eDVBDemux> m_demux; int m_active; void data(int); - eSocketNotifier *m_notifier; + ePtr<eSocketNotifier> m_notifier; public: eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res); virtual ~eDVBPESReader(); diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index bfbd9b5..01eb27a 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -443,7 +443,7 @@ int eDVBFrontend::PriorityOrder=0; eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) :m_simulate(simulate), m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe) ,m_fd(-1), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) - ,m_sn(0), m_timeout(0), m_tuneTimer(0) + , m_timeout(0), m_tuneTimer(0) #if HAVE_DVB_API_VERSION < 3 ,m_secfd(-1) #endif @@ -555,7 +555,7 @@ int eDVBFrontend::openFrontend() if (!m_simulate) { - m_sn = new eSocketNotifier(eApp, m_fd, eSocketNotifier::Read, false); + m_sn = eSocketNotifier::create(eApp, m_fd, eSocketNotifier::Read, false); CONNECT(m_sn->activated, eDVBFrontend::feEvent); } @@ -607,7 +607,6 @@ int eDVBFrontend::closeFrontend(bool force) eWarning("couldnt close sec %d", m_dvbid); } #endif - delete m_sn; m_sn=0; m_state = stateClosed; diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 0ab2387..61ea3bc 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -85,7 +85,7 @@ private: FRONTENDPARAMETERS parm; int m_state; ePtr<iDVBSatelliteEquipmentControl> m_sec; - eSocketNotifier *m_sn; + ePtr<eSocketNotifier> m_sn; int m_tuning; eTimer *m_timeout; eTimer *m_tuneTimer; diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index c0447b4..8364be5 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -671,7 +671,7 @@ ChannelMap eDVBCAService::exist_channels; ePtr<eConnection> eDVBCAService::m_chanAddedConn; eDVBCAService::eDVBCAService() - :m_sn(0), m_prev_build_hash(0), m_sendstate(0), m_retryTimer(eApp) + : m_prev_build_hash(0), m_sendstate(0), m_retryTimer(eApp) { memset(m_used_demux, 0xFF, sizeof(m_used_demux)); CONNECT(m_retryTimer.timeout, eDVBCAService::sendCAPMT); @@ -682,7 +682,6 @@ eDVBCAService::~eDVBCAService() { eDebug("[eDVBCAService] free service %s", m_service.toString().c_str()); ::close(m_sock); - delete m_sn; } // begin static methods @@ -876,10 +875,7 @@ void eDVBCAService::socketCB(int what) void eDVBCAService::Connect() { - if (m_sn) { - delete m_sn; - m_sn=0; - } + m_sn=0; memset(&m_servaddr, 0, sizeof(struct sockaddr_un)); m_servaddr.sun_family = AF_UNIX; strcpy(m_servaddr.sun_path, "/tmp/camd.socket"); @@ -892,7 +888,7 @@ void eDVBCAService::Connect() int val=1; fcntl(m_sock, F_SETFL, O_NONBLOCK); setsockopt(m_sock, SOL_SOCKET, SO_REUSEADDR, &val, 4); - m_sn = new eSocketNotifier(eApp, m_sock, + m_sn = eSocketNotifier::create(eApp, m_sock, eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Error|eSocketNotifier::Hungup); CONNECT(m_sn->activated, eDVBCAService::socketCB); diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h index 9b33d30..bd6c4f1 100644 --- a/lib/dvb/pmt.h +++ b/lib/dvb/pmt.h @@ -35,7 +35,7 @@ typedef std::map<iDVBChannel*, channel_data*> ChannelMap; class eDVBCAService: public Object { - eSocketNotifier *m_sn; + ePtr<eSocketNotifier> m_sn; eServiceReferenceDVB m_service; uint8_t m_used_demux[32]; unsigned int m_prev_build_hash; |