From 56d49abc22f61b5343f2e99fa1511508cf1d7aba Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 9 Apr 2006 11:28:59 +0200 Subject: [PATCH] cSkins::QueueMessage() called from a background thread with an empty message now clears all messages that have been previously queued by that thread --- CONTRIBUTORS | 2 ++ HISTORY | 3 +++ skins.c | 13 +++++++++++-- skins.h | 6 ++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1203e9a5..b1a99f55 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1648,6 +1648,8 @@ Alexander Rieger added or deleted, so that other VDR instances can update their lists for adding cSkin::GetTextAreaWidth() and cSkin::GetTextAreaFont() for fixing a typo in skins.h + for making cSkins::QueueMessage() called from a background thread with an empty + message clears all messages that have been previously queued by that thread Philip Prindeville for updates to 'sources.conf' diff --git a/HISTORY b/HISTORY index dd097fae..d50ea48f 100644 --- a/HISTORY +++ b/HISTORY @@ -4481,3 +4481,6 @@ Video Disk Recorder Revision History - Now avoiding the 'actual' device when starting a recording, so that a Transfer Mode for live tv isn't interrupted. - Fixed a typo in skins.h (thanks to Alexander Rieger). +- cSkins::QueueMessage() called from a background thread with an empty message + now clears all messages that have been previously queued by that thread and have + not yet beed displayed (thanks to Alexander Rieger). diff --git a/skins.c b/skins.c index 0952b118..736d7dad 100644 --- a/skins.c +++ b/skins.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.c 1.8 2006/02/05 14:53:04 kls Exp $ + * $Id: skins.c 1.9 2006/04/09 11:25:30 kls Exp $ */ #include "skins.h" @@ -255,7 +255,16 @@ int cSkins::QueueMessage(eMessageType Type, const char *s, int Seconds, int Time return kNone; } if (isempty(s)) { - dsyslog("cSkins::QueueMessage() called with empty message - ignored!"); + if (!cThread::IsMainThread()) { + queueMessageMutex.Lock(); + for (cSkinQueuedMessage *m = SkinQueuedMessages.Last(); m; m = SkinQueuedMessages.Prev(m)) { + if (m->threadId == cThread::ThreadId() && m->state == 0) + m->state = 2; // done + } + queueMessageMutex.Unlock(); + } + else + dsyslog("cSkins::QueueMessage() called with empty message from main thread - ignored!"); return kNone; } int k = kNone; diff --git a/skins.h b/skins.h index 80bac766..225fbc22 100644 --- a/skins.h +++ b/skins.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 1.12 2006/04/09 11:15:24 kls Exp $ + * $Id: skins.h 1.13 2006/04/09 11:23:35 kls Exp $ */ #ifndef __SKINS_H @@ -353,7 +353,9 @@ public: ///< progress displays, where only the most recent message is actually ///< important. ///< Type may only be mtInfo, mtWarning or mtError. A call with mtStatus - ///< will be ignored, as will be one with an empty message. + ///< will be ignored. A call with an empty message from a background thread + ///< removes all queued messages from the calling thread. A call with + ///< an empty message from the main thread will be ignored. void ProcessQueuedMessages(void); ///< Processes the first queued message, if any. void Flush(void);