From c169e2014130b9b082586bacecdf1377f7bb0f22 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 1 Sep 2013 09:20:07 +0200 Subject: [PATCH] Fixed cleaning up old EPG events in case no epg data file is given --- CONTRIBUTORS | 1 + HISTORY | 4 +++- epg.c | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ee3785a7..b749d083 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2957,6 +2957,7 @@ Johan Andersson Dave Pickles for adding support for "content identifier descriptor" and "default authority descriptor" to 'libsi' + for reporting that old EPG events are not cleaned up in case no epg data file is given Holger Dengler for making the isnumber() function check the given pointer for NULL diff --git a/HISTORY b/HISTORY index 4a7f8e7c..05109534 100644 --- a/HISTORY +++ b/HISTORY @@ -7813,7 +7813,7 @@ Video Disk Recorder Revision History - Fixed a crash in the LCARS skin's main menu in case there is no current channel (reported by Dominique Dumont). -2013-08-23: Version 2.0.3 +2013-09-01: Version 2.0.3 - Fixed asserting free disk space in the cutter. - No longer trying to delete old recordings in AssertFreeDiskSpace() if the given @@ -7829,3 +7829,5 @@ Video Disk Recorder Revision History - All bonded devices (except for the master) now turn off their LNB power completely to avoid problems when receiving vertically polarized transponders (suggested by Manfred Völkel and Oliver Endriss). +- Fixed cleaning up old EPG events in case no epg data file is given (reported by + Dave Pickles). diff --git a/epg.c b/epg.c index 5fb49ae4..ce7e7f8e 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 2.23 2013/02/17 14:12:07 kls Exp $ + * $Id: epg.c 2.23.1.1 2013/09/01 09:16:53 kls Exp $ */ #include "epg.h" @@ -1140,16 +1140,19 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules) class cEpgDataWriter : public cThread { private: cMutex mutex; + bool dump; protected: virtual void Action(void); public: cEpgDataWriter(void); + void SetDump(bool Dump) { dump = Dump; } void Perform(void); }; cEpgDataWriter::cEpgDataWriter(void) :cThread("epg data writer", true) { + dump = false; } void cEpgDataWriter::Action(void) @@ -1169,7 +1172,8 @@ void cEpgDataWriter::Perform(void) p->Cleanup(now); } } - cSchedules::Dump(); + if (dump) + cSchedules::Dump(); } static cEpgDataWriter EpgDataWriter; @@ -1203,6 +1207,7 @@ void cSchedules::SetEpgDataFileName(const char *FileName) { free(epgDataFileName); epgDataFileName = FileName ? strdup(FileName) : NULL; + EpgDataWriter.SetDump(epgDataFileName != NULL); } void cSchedules::SetModified(cSchedule *Schedule) @@ -1217,12 +1222,10 @@ void cSchedules::Cleanup(bool Force) lastDump = 0; time_t now = time(NULL); if (now - lastDump > EPGDATAWRITEDELTA) { - if (epgDataFileName) { - if (Force) - EpgDataWriter.Perform(); - else if (!EpgDataWriter.Active()) - EpgDataWriter.Start(); - } + if (Force) + EpgDataWriter.Perform(); + else if (!EpgDataWriter.Active()) + EpgDataWriter.Start(); lastDump = now; } }