From 5dbe8c646423aad0012983630e3f1c669f4eca32 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 2 May 2012 17:47:04 +0400 Subject: [PATCH 1/7] driver/vfd.cpp: init mode variable in ctor --- src/driver/vfd.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 5db9a4a14..b1348aa8a 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -67,6 +67,7 @@ CVFD::CVFD() } text[0] = 0; clearClock = 0; + mode = MODE_TVRADIO; } CVFD::~CVFD() From 45b7368c26c14da3e7339bfb0b683d503152086a Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 2 May 2012 17:49:58 +0400 Subject: [PATCH 2/7] zapit/src/bouquets.cpp: add destructor --- src/zapit/include/zapit/bouquets.h | 1 + src/zapit/src/bouquets.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index 1dc8253db..9b081a87d 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -75,6 +75,7 @@ class CBouquetManager public: CBouquetManager() { remainChannels = NULL; }; + ~CBouquetManager(); class ChannelIterator { private: diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 2f24dd316..3da8edcbf 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -179,6 +179,11 @@ size_t CZapitBouquet::recModeTVSize(const transponder_id_t transponder_id) return size; } +CBouquetManager::~CBouquetManager() +{ + clearAll(); +} + void CBouquetManager::writeBouquetHeader(FILE * bouq_fd, uint32_t i, const char * bouquetName) { //printf("[bouquets] writing bouquet header: %s\n", bouquetName); From 194558d0a7529e856d3295015ffaa4b0e852b6fc Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 3 May 2012 17:37:19 +0400 Subject: [PATCH 3/7] neutrino.cpp: remove unused g_volscale --- src/neutrino.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a5fd7cdf1..1adb7c2f7 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -129,7 +129,6 @@ bool autoshift = false; uint32_t scrambled_timer; t_channel_id standby_channel_id; -static CProgressBar *g_volscale; //NEW static pthread_t timer_thread; void * timerd_main_thread(void *data); @@ -1890,7 +1889,6 @@ TIMER_START(); int dx, dy; frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &dx, &dy); - g_volscale = new CProgressBar(true, dy * 125 / 10, dy, 50, 100, 80, true); g_CamHandler = new CCAMMenuHandler(); g_CamHandler->init(); From dc51526e89b39f070ea6fe9ec1137a5a87ab44f7 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 2 May 2012 17:53:42 +0400 Subject: [PATCH 4/7] eitd/sectionsd.cpp: split commandFreeMemory, call FreeMemory at exit if configured --- src/eitd/sectionsd.cpp | 46 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 0e66df572..4585c7cae 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -821,6 +821,18 @@ static void sendEmptyResponse(int connfd, char *, const unsigned) // handles incoming requests //--------------------------------------------------------------------- +static void wakeupAll() +{ + threadCN.change(0); + threadEIT.change(0); +#ifdef ENABLE_FREESATEPG + threadFSEIT.change(0); +#endif +#ifdef ENABLE_SDT + threadSDT.change(0); +#endif +} + static void commandPauseScanning(int connfd, char *data, const unsigned dataLength) { if (dataLength != sizeof(int)) @@ -874,15 +886,7 @@ static void commandPauseScanning(int connfd, char *data, const unsigned dataLeng { threadTIME.change(0); } - - threadCN.change(0); - threadEIT.change(0); -#ifdef ENABLE_FREESATEPG - threadFSEIT.change(0); -#endif -#ifdef ENABLE_SDT - threadSDT.change(0); -#endif + wakeupAll(); } sendEmptyResponse(connfd, NULL, 0); } @@ -1096,25 +1100,19 @@ static void commandSetConfig(int connfd, char *data, const unsigned /*dataLength static void deleteSIexceptEPG() { + threadCN.dropCachedSectionIDs(); threadEIT.dropCachedSectionIDs(); - threadEIT.change(0); #ifdef ENABLE_SDT writeLockServices(); mySIservicesOrderUniqueKey.clear(); unlockServices(); threadSDT.dropCachedSectionIDs(); - threadSDT.change(0); -#endif -#ifdef ENABLE_FREESATEPG - threadFSEIT.setCurrentService(messaging_current_servicekey); - threadFSEIT.change(0); #endif } -static void commandFreeMemory(int connfd, char * /*data*/, const unsigned /*dataLength*/) +static void FreeMemory() { - sendEmptyResponse(connfd, NULL, 0); - + xprintf("[sectionsd] free memory...\n"); deleteSIexceptEPG(); writeLockEvents(); @@ -1143,6 +1141,14 @@ static void commandFreeMemory(int connfd, char * /*data*/, const unsigned /*data unlockEvents(); malloc_stats(); + xprintf("[sectionsd] free memory done\n"); + //wakeupAll(); //FIXME should we re-start eit here ? +} + +static void commandFreeMemory(int connfd, char * /*data*/, const unsigned /*dataLength*/) +{ + sendEmptyResponse(connfd, NULL, 0); + FreeMemory(); } static void commandReadSIfromXML(int connfd, char *data, const unsigned dataLength) @@ -2165,6 +2171,10 @@ printf("SIevent size: %d\n", sizeof(SIevent)); #ifdef ENABLE_FREESATEPG xprintf("join FSEIT\n"); threadFSEIT.Stop(); +#endif +#ifdef EXIT_CLEANUP + xprintf("[sectionsd] cleanup...\n"); + FreeMemory(); #endif xprintf("[sectionsd] stopped\n"); } From c5f458b3ebdee0f08bc5b33c28c4e65a1e0ffc28 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 2 May 2012 17:51:34 +0400 Subject: [PATCH 5/7] zapit/src/getservices.cpp: clear transponders in dtor --- src/zapit/src/getservices.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 7a33c2250..6324f2402 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -46,6 +46,7 @@ CServiceManager::CServiceManager() CServiceManager::~CServiceManager() { delete scanInputParser; + transponders.clear(); } CServiceManager * CServiceManager::getInstance() From 63d869922c1f7980ecd7e5ed3e881b5245d3cb75 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 3 May 2012 17:28:55 +0400 Subject: [PATCH 6/7] zapit/src/zapit.cpp: delete eventServer, g_bouquetManager, CServiceManager, CServiceScan --- src/zapit/src/zapit.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 83dd5f248..ab874c4b7 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2155,6 +2155,13 @@ void CZapit::run() ca->Stop(); delete ca; } +#ifdef EXIT_CLEANUP + INFO("cleanup..."); + delete eventServer; + delete g_bouquetManager; + delete CServiceManager::getInstance(); + delete CServiceScan::getInstance(); +#endif INFO("shutdown complete"); return; } From 151ad95def02461178026b5579c822a92baa95e0 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 2 May 2012 17:48:55 +0400 Subject: [PATCH 7/7] configure.ac: add --enable-cleanup which add EXIT_CLEANUP define, to ifdef code for testing with valgrind --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index e61d97be0..d1d0378da 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,10 @@ if test "$enable_upnp" = "yes"; then AC_DEFINE(ENABLE_UPNP,1,[include UPNP support - currently broken]) fi +AC_ARG_ENABLE(cleanup, + [ --enable-cleanup enable cleanup on exit], + [AC_DEFINE(EXIT_CLEANUP,1,[enable cleanup on exit])]) + AC_CHECK_HEADERS(coolstream/nevis_ir.h) #