If cSkins::Message() is called from a background thread and Type is not mtStatus, the call is now automatically forwarded to QueueMessage()

This commit is contained in:
Klaus Schmidinger 2019-05-29 16:44:55 +02:00
parent 712523f004
commit 0873d14614
3 changed files with 10 additions and 3 deletions

View File

@ -9415,3 +9415,5 @@ Video Disk Recorder Revision History
- Fixed inconsistent behavior in case only certain devices are used (selected by the '-D'
option).
- Fixed a wrong variable name in cFileName::cFileName().
- If cSkins::Message() is called from a background thread and Type is not mtStatus,
the call is now automatically forwarded to QueueMessage().

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 4.1 2018/04/28 12:13:01 kls Exp $
* $Id: skins.c 4.2 2019/05/29 16:43:09 kls Exp $
*/
#include "skins.h"
@ -250,7 +250,10 @@ bool cSkins::SetCurrent(const char *Name)
eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds)
{
if (!cThread::IsMainThread()) {
dsyslog("cSkins::Message() called from background thread - ignored! (Use cSkins::QueueMessage() instead)");
if (Type != mtStatus)
QueueMessage(Type, s, Seconds);
else
dsyslog("cSkins::Message(%d, \"%s\", %d) called from background thread - ignored! (Use cSkins::QueueMessage() instead)", Type, s, Seconds);
return kNone;
}
switch (Type) {

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 4.5 2017/11/02 15:04:56 kls Exp $
* $Id: skins.h 4.6 2019/05/29 16:36:41 kls Exp $
*/
#ifndef __SKINS_H
@ -477,6 +477,8 @@ public:
///< has been received within Seconds (the default value of 0 results
///< in the value defined for "Message time" in the setup), kNone
///< will be returned.
///< If Message() is called from a background thread and Type is not
///< mtStatus, the call will be automatically forwarded to QueueMessage().
int QueueMessage(eMessageType Type, const char *s, int Seconds = 0, int Timeout = 0);
///< Like Message(), but this function may be called from a background
///< thread. The given message is put into a queue and the main program