mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
b server sim switching
Rearranges the order of operations during simulator switching to ensure that the previous simulator is properly stopped and disconnected before the new simulator is started.
This commit is contained in:
@@ -118,23 +118,19 @@ void Simulators::switch_simulator(std::string name)
|
|||||||
SPDLOG_WARN("no simulators found");
|
SPDLOG_WARN("no simulators found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this->m_current_simulator.empty())
|
|
||||||
{
|
|
||||||
SPDLOG_INFO("stopping current simulator {} and switching to {}", m_current_simulator, name);
|
|
||||||
this->m_simulators.at(m_current_simulator)->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->m_simulators.find(name) == this->m_simulators.end())
|
if (this->m_simulators.find(name) == this->m_simulators.end())
|
||||||
{
|
{
|
||||||
SPDLOG_WARN("simulator {} not found", name);
|
SPDLOG_WARN("simulator {} not found", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->stop();
|
|
||||||
if (!this->m_current_simulator.empty())
|
if (!this->m_current_simulator.empty())
|
||||||
{
|
{
|
||||||
|
SPDLOG_INFO("stopping current simulator {} and switching to {}", m_current_simulator, name);
|
||||||
|
this->m_simulators.at(m_current_simulator)->stop();
|
||||||
disconnect(m_simulators.at(m_current_simulator).get());
|
disconnect(m_simulators.at(m_current_simulator).get());
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_current_simulator = name;
|
this->m_current_simulator = name;
|
||||||
connect(m_simulators.at(m_current_simulator).get(), &Simulator_base::sim_changed, this,
|
connect(m_simulators.at(m_current_simulator).get(), &Simulator_base::sim_changed, this,
|
||||||
[this] {
|
[this] {
|
||||||
|
|||||||
Reference in New Issue
Block a user