From 2c4f42608b2c5aae6b8aa934ed0fce49a6db2294 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Dec 2019 00:05:16 +0100 Subject: [PATCH] Avoid spurious error from wxThread::SetPriority() in wxMSW Just skip calling ::SetThreadPriority() if the thread hadn't been created yet: this was useless and just resulted in an error message. --- src/msw/thread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index a04625d4fd..3c3d7c8b74 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -606,6 +606,14 @@ void wxThreadInternal::SetPriority(unsigned int priority) { m_priority = priority; + if ( !m_hThread ) + { + // The thread hasn't been created yet, so calling SetThreadPriority() + // right now would just result in an error -- just skip doing this, as + // the priority will be set when Create() is called later. + return; + } + // translate wxWidgets priority to the Windows one int win_priority; if (m_priority <= 20)