From e9a9dda457bc5b79f55236b89ae7241ed81ec0e7 Mon Sep 17 00:00:00 2001 From: magiblot Date: Fri, 25 Oct 2024 03:41:15 +0200 Subject: [PATCH] TProgram: fix event wait timeout when eventTimeoutMs is negative --- source/tvision/tprogram.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/tvision/tprogram.cpp b/source/tvision/tprogram.cpp index 4bdb407f..b65f24c2 100644 --- a/source/tvision/tprogram.cpp +++ b/source/tvision/tprogram.cpp @@ -100,10 +100,12 @@ Boolean TProgram::canMoveFocus() int TProgram::eventWaitTimeout() { - int timerTimeoutMs = min(timerQueue.timeUntilNextTimeout(), (int32_t) INT_MAX); - if (timerTimeoutMs < 0) + int timerTimeoutMs = min( timerQueue.timeUntilNextTimeout(), (int32_t) INT_MAX ); + if( timerTimeoutMs < 0 ) return eventTimeoutMs; - return min(eventTimeoutMs, timerTimeoutMs); + if( eventTimeoutMs < 0 ) + return timerTimeoutMs; + return min( eventTimeoutMs, timerTimeoutMs ); } ushort TProgram::executeDialog( TDialog* pD, void* data )