From b40baffe54fd8f171fe78abfc8d90462fc091d97 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Mon, 26 Jun 2023 13:53:08 +0300 Subject: [PATCH] UI: RpcManager::sendCommandDataToClients: Set thread busy --- src/ui/control/controlmanager.cpp | 8 +++++++- src/ui/rpc/rpcmanager.cpp | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ui/control/controlmanager.cpp b/src/ui/control/controlmanager.cpp index 6099b1ff..13f01294 100644 --- a/src/ui/control/controlmanager.cpp +++ b/src/ui/control/controlmanager.cpp @@ -175,7 +175,13 @@ bool ControlManager::processRequest(Control::Command command, const QVariantList OsUtil::setThreadIsBusy(true); QString errorMessage; - const bool success = processCommand({ w, command, args, errorMessage }); + const bool success = processCommand({ + .worker = w, + .command = command, + .args = args, + .errorMessage = errorMessage, + }); + if (!success) { qCWarning(LC) << "Bad command" << errorMessage << ':' << command << args; } diff --git a/src/ui/rpc/rpcmanager.cpp b/src/ui/rpc/rpcmanager.cpp index 41ac11a2..8d010c14 100644 --- a/src/ui/rpc/rpcmanager.cpp +++ b/src/ui/rpc/rpcmanager.cpp @@ -17,6 +17,7 @@ #include #include #include +#include namespace { @@ -35,6 +36,8 @@ inline bool sendCommandDataToClients( { bool ok = true; + OsUtil::setThreadIsBusy(true); + for (ControlWorker *w : clients) { if (!w->isServiceClient()) continue; @@ -45,6 +48,8 @@ inline bool sendCommandDataToClients( } } + OsUtil::setThreadIsBusy(false); + return ok; }