From f5308255a9b3630439b8fe115f45d68150588acb Mon Sep 17 00:00:00 2001 From: lordjaxom Date: Tue, 25 Jan 2005 15:15:53 +0000 Subject: - fixed segfault happening when deleting a running timer when {CurrentRecording} is used in the same display --- status.c | 24 +++++++++--------------- status.h | 9 ++------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/status.c b/status.c index 32be887..4b7a4b9 100644 --- a/status.c +++ b/status.c @@ -1,5 +1,5 @@ /* - * $Id: status.c,v 1.7 2005/01/15 21:02:40 lordjaxom Exp $ + * $Id: status.c,v 1.8 2005/01/25 15:15:53 lordjaxom Exp $ */ #include "status.h" @@ -88,19 +88,13 @@ void cText2SkinStatus::Recording(const cDevice *Device, const char *Name) if (mRender != NULL) mRender->UpdateLock(); - if (Name != NULL) { - tRecordingInfo info(Name, Device); - mRecordings.push_back(info); - } else { - tRecordings::iterator it = mRecordings.begin(); - for (; it != mRecordings.end(); ++it) { - if ((*it).device == Device && StoppedTimer((*it).name.c_str())) { - mRecordings.erase(it); - break; - } - } + mRecordings.clear(); + cTimer *t = Timers.First(); + for (; t != NULL; t = Timers.Next(t)) { + if (t->Recording()) + mRecordings.push_back(t->File()); } - + if (mRender != NULL) { mRender->UpdateUnlock(); mRender->Flush(true); @@ -125,7 +119,7 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) Dprintf("token attrib type is: %d, number: %d\n", Token.Attrib.Type, Token.Attrib.Number); if (Token.Attrib.Type == aNumber) { return mRecordings.size() > (uint)Token.Attrib.Number - ? (cxType)mRecordings[Token.Attrib.Number].name + ? (cxType)mRecordings[Token.Attrib.Number] : (cxType)false; } else if (mRecordings.size() > 0) { uint now = time_ms(); @@ -142,7 +136,7 @@ cxType cText2SkinStatus::GetTokenData(const txToken &Token) Dprintf("next update in %d ms\n", next); } - cxType res = mRecordings[mCurrentRecording].name; + cxType res = mRecordings[mCurrentRecording]; res.SetUpdate(next); return res; } diff --git a/status.h b/status.h index 84278d4..06e45ee 100644 --- a/status.h +++ b/status.h @@ -1,5 +1,5 @@ /* - * $Id: status.h,v 1.5 2005/01/15 21:02:40 lordjaxom Exp $ + * $Id: status.h,v 1.6 2005/01/25 15:15:53 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_STATUS_H @@ -24,12 +24,7 @@ public: #define __REPLAY_COUNT__ (cText2SkinStatus::replayImage+1) }; - struct tRecordingInfo { - std::string name; - const cDevice *device; - - tRecordingInfo(const std::string &n, const cDevice *d): name(n), device(d) {} - }; + typedef std::string tRecordingInfo; typedef std::vector tRecordings; private: -- cgit v1.2.3