mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +08:00
Move CInputManager from singleton to CApplication member
The main reason why CInputManager was singleton is the easy access across the code. That had the negative side effect that time of destruction was at a very late stage of the shutdown and could not be controlled by us. My moving it to CApplication, the access is equally easy (using sApp) and allows to be cleaned up properly during graceful shutdown. ref T391
This commit is contained in:
committed by
Klaus Basan
parent
705a56b1cb
commit
f6ea2a9107
@@ -163,7 +163,6 @@ namespace BlackCore
|
||||
|
||||
this->initNetwork();
|
||||
|
||||
|
||||
// global setup
|
||||
m_setupReader.reset(new CSetupReader(this));
|
||||
connect(m_setupReader.data(), &CSetupReader::setupHandlingCompleted, this, &CApplication::onSetupHandlingCompleted, Qt::QueuedConnection);
|
||||
@@ -179,7 +178,8 @@ namespace BlackCore
|
||||
|
||||
if (!this->getApplicationInfo().isUnitTest())
|
||||
{
|
||||
CInputManager::instance()->createDevices();
|
||||
m_inputManager = new CInputManager(this);
|
||||
m_inputManager->createDevices();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -985,7 +985,7 @@ namespace BlackCore
|
||||
|
||||
// Release all input devices to not cause any accidental hotkey triggers anymore.
|
||||
// This is also necessary to properly free platform specific instances at a defined point in time.
|
||||
CInputManager::instance()->releaseDevices();
|
||||
if (m_inputManager) { m_inputManager->releaseDevices(); }
|
||||
|
||||
// mark as shutdown
|
||||
if (m_networkWatchDog) { m_networkWatchDog->gracefulShutdown(); }
|
||||
@@ -1002,8 +1002,6 @@ namespace BlackCore
|
||||
|
||||
// from here on we really rip apart the application object
|
||||
// and it should no longer be used
|
||||
sApp = nullptr;
|
||||
disconnect(this);
|
||||
|
||||
if (this->supportsContexts())
|
||||
{
|
||||
@@ -1031,6 +1029,11 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
m_fileLogger->close();
|
||||
|
||||
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
||||
|
||||
sApp = nullptr;
|
||||
disconnect(this);
|
||||
}
|
||||
|
||||
void CApplication::onSetupHandlingCompleted(bool available)
|
||||
|
||||
Reference in New Issue
Block a user