From 3a1f47e69d436004cee8f346ca690524603d5258 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Thu, 13 Jun 2024 13:52:21 +0200 Subject: [PATCH] Do not poll printers when not top window --- src/slic3r/GUI/UserAccountCommunication.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/UserAccountCommunication.cpp b/src/slic3r/GUI/UserAccountCommunication.cpp index 29e69aad6c..a4e82a89c3 100644 --- a/src/slic3r/GUI/UserAccountCommunication.cpp +++ b/src/slic3r/GUI/UserAccountCommunication.cpp @@ -399,10 +399,9 @@ void UserAccountCommunication::init_session_thread() m_polling_timer->Start(10000); m_thread = std::thread([this]() { for (;;) { - // Wait for 5 seconds or wakeup call { std::unique_lock lck(m_thread_stop_mutex); - m_thread_stop_condition.wait_for(lck, std::chrono::seconds(1000), [this] { return m_thread_stop || m_thread_wakeup; }); + m_thread_stop_condition.wait_for(lck, std::chrono::seconds(88888), [this] { return m_thread_stop || m_thread_wakeup; }); } if (m_thread_stop) // Stop the worker thread. @@ -451,6 +450,9 @@ void UserAccountCommunication::on_token_timer(wxTimerEvent& evt) } void UserAccountCommunication::on_polling_timer(wxTimerEvent& evt) { + if (!m_window_is_active) { + return; + } wakeup_session_thread(); }