cSkins::QueueMessage() called from a background thread with an empty message now clears all messages that have been previously queued by that thread

This commit is contained in:
Klaus Schmidinger 2006-04-09 11:28:59 +02:00
parent 2cd5bf83fb
commit 56d49abc22
4 changed files with 20 additions and 4 deletions

View File

@ -1648,6 +1648,8 @@ Alexander Rieger <Alexander.Rieger@inka.de>
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 <philipp_subx@redfish-solutions.com>
for updates to 'sources.conf'

View File

@ -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).

13
skins.c
View File

@ -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;

View File

@ -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);