mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
CPluginManagerSimulator::getListener should not create listeners
Up to now, CPluginManagerSimulator::getListener was allocating a listener automatically in the background which was not always the desired behaviour. For example in case simulators are stopped, it is unnecessary to allocate all listeners and call stop on them. It is enough to stop the existing ones. In order to achieve the correct behaviour the creation part is moved to CPluginManagerSimulator::createListener. refs #606
This commit is contained in:
@@ -69,6 +69,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
ISimulatorListener *listener = m_plugins->getListener(simulatorInfo.getIdentifier());
|
||||
Q_ASSERT(listener);
|
||||
QMetaObject::invokeMethod(listener, "stop");
|
||||
}
|
||||
|
||||
@@ -396,7 +397,7 @@ namespace BlackCore
|
||||
m_listenersThread.start(QThread::LowPriority);
|
||||
}
|
||||
|
||||
ISimulatorListener *listener = m_plugins->getListener(simulatorInfo.getIdentifier());
|
||||
ISimulatorListener *listener = m_plugins->createListener(simulatorInfo.getIdentifier());
|
||||
Q_ASSERT_X(listener, Q_FUNC_INFO, "No listener");
|
||||
|
||||
if (listener->thread() != &m_listenersThread)
|
||||
@@ -584,7 +585,7 @@ namespace BlackCore
|
||||
for (const auto &info : getAvailableSimulatorPlugins())
|
||||
{
|
||||
ISimulatorListener *listener = m_plugins->getListener(info.getIdentifier());
|
||||
QMetaObject::invokeMethod(listener, "stop");
|
||||
if(listener) { QMetaObject::invokeMethod(listener, "stop"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user