From a2befb3ff996f240bb3f264e08d66b422b9e2da1 Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Mon, 20 Oct 2025 19:53:49 +0200 Subject: [PATCH] b server simulators broadcast - Fix for separate message for each ui change/sim change event by putting Qt::QueuedConnection - Avoids broadcasting empty JSON objects produced by the change above mentioned --- server/simulators.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/simulators.cpp b/server/simulators.cpp index 3b4add8..e0ef15a 100644 --- a/server/simulators.cpp +++ b/server/simulators.cpp @@ -137,7 +137,12 @@ void Simulators::switch_simulator(std::string name) } this->m_current_simulator = name; connect(m_simulators.at(m_current_simulator).get(), &Simulator_base::sim_changed, this, - [this] { m_server->broadcast(QString::fromStdString(changed_UI_items().dump())); }); + [this] { + auto json = changed_UI_items(); + if (!json.empty()) { + m_server->broadcast(QString::fromStdString(json.dump())); + } + }, Qt::QueuedConnection); this->run(); }