diff options
author | Jasmin Jessich <jasmin@anw.at> | 2017-06-18 02:13:40 +0200 |
---|---|---|
committer | Jasmin Jessich <jasmin@anw.at> | 2017-06-18 02:22:24 +0200 |
commit | 914fc339749a5d625bc0aa6367cb1c950df7702b (patch) | |
tree | 512268bdc60edf9d72cf6c48db089e4bfd00dbd7 /timers.h | |
parent | 18d3b23cf039ce1d1efb2898d4a8bd812a023f11 (diff) | |
download | vdr-plugin-live-914fc339749a5d625bc0aa6367cb1c950df7702b.tar.gz vdr-plugin-live-914fc339749a5d625bc0aa6367cb1c950df7702b.tar.bz2 |
Protect stored timers in SortedTimers list
- SortedTimers::GetByTimerId will now return "const cTimer *" to be sure the
timer is never modified within live. Modifying or more worse deleting such
a timer can lead to a segfault. This is no longer the case, but using const
may protect future mistakes.
Diffstat (limited to 'timers.h')
-rw-r--r-- | timers.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -15,7 +15,7 @@ namespace vdrlive { public: static std::string GetTimerId(cTimer const& timer); - cTimer* GetByTimerId(std::string const& timerid); + const cTimer* GetByTimerId(std::string const& timerid); // en- or decodes a timer into an id usable for DOM Ids. static std::string EncodeDomId(std::string const& timerid); @@ -53,11 +53,11 @@ namespace vdrlive { public: SortedTimers& GetTimers() { return m_timers; } - void UpdateTimer( cTimer* timer, int flags, tChannelID& channel, std::string const& weekdays, std::string const& day, + void UpdateTimer( const cTimer* timer, int flags, tChannelID& channel, std::string const& weekdays, std::string const& day, int start, int stop, int priority, int lifetime, std::string const& title, std::string const& aux ); - void DelTimer( cTimer* timer); - void ToggleTimerActive( cTimer* timer); + void DelTimer( const cTimer* timer); + void ToggleTimerActive( const cTimer* timer); // may only be called from Plugin::MainThreadHook void DoPendingWork(); void DoReloadTimers() { m_timers.ReloadTimers(); m_reloadTimers = false; } @@ -65,7 +65,7 @@ namespace vdrlive { void SetReloadTimers() { m_reloadTimers = true; } private: - typedef std::pair< cTimer*, std::string > TimerPair; + typedef std::pair< const cTimer*, std::string > TimerPair; typedef std::pair< TimerPair, std::string > ErrorPair; typedef std::list< TimerPair > TimerList; typedef std::list< ErrorPair > ErrorList; |