fix: Delete order of threads (#846)

* Fix #668 by fixing delete order of threads

* update changelog

Co-authored-by: Sersch <edeltraud70@gmx.de>
This commit is contained in:
Murat Seker 2020-06-28 23:42:57 +02:00 committed by GitHub
parent 0cb1ab2be1
commit a68ed7d44f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 11 deletions

View File

@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- device: Nanoleaf (#829) - device: Nanoleaf (#829)
- device: LPD8806 Problems fixed (#829) - device: LPD8806 Problems fixed (#829)
- Possible crash on shutdown (#846). Issue #668
- Enumerate only V4L2 frame sizes & intervals for framesize type DISCRETE (fix BCM2835 ISP) (#820) - Enumerate only V4L2 frame sizes & intervals for framesize type DISCRETE (fix BCM2835 ISP) (#820)
- Fix systemd registration in debian for RPi4 (#820) - Fix systemd registration in debian for RPi4 (#820)
- Fix missing define in Profiler & added header notes (#820) - Fix missing define in Profiler & added header notes (#820)

View File

@ -29,7 +29,7 @@ PythonInit::PythonInit()
// set Python module path when exists // set Python module path when exists
wchar_t *pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python")).toLatin1().data(), nullptr); wchar_t *pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python")).toLatin1().data(), nullptr);
#ifdef _WIN32 #ifdef _WIN32
pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath()) + "/python" + STRINGIFY(PYTHON_VERSION_MAJOR_MINOR) ".zip").toLatin1().data(), nullptr); pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath()) + "/python" + STRINGIFY(PYTHON_VERSION_MAJOR_MINOR) + ".zip").toLatin1().data(), nullptr);
if(QFile(QString::fromWCharArray(pythonPath)).exists()) if(QFile(QString::fromWCharArray(pythonPath)).exists())
#else #else
if(QDir(QString::fromWCharArray(pythonPath)).exists()) if(QDir(QString::fromWCharArray(pythonPath)).exists())

View File

@ -170,15 +170,29 @@ void HyperionDaemon::freeObjects()
delete _jsonServer; delete _jsonServer;
_flatBufferServer->thread()->quit(); _flatBufferServer->thread()->quit();
_flatBufferServer->thread()->wait(1000); _flatBufferServer->thread()->wait(1000);
_flatBufferServer->deleteLater();
_flatBufferServer->thread()->deleteLater();
_protoServer->thread()->quit(); _protoServer->thread()->quit();
_protoServer->thread()->wait(1000); _protoServer->thread()->wait(1000);
_protoServer->deleteLater();
_protoServer->thread()->deleteLater();
//ssdp before webserver //ssdp before webserver
_ssdp->thread()->quit(); _ssdp->thread()->quit();
_ssdp->thread()->wait(1000); _ssdp->thread()->wait(1000);
_ssdp->deleteLater();
_ssdp->thread()->deleteLater();
_webserver->thread()->quit(); _webserver->thread()->quit();
_webserver->thread()->wait(1000); _webserver->thread()->wait(1000);
_webserver->deleteLater();
_webserver->thread()->deleteLater();
_sslWebserver->thread()->quit(); _sslWebserver->thread()->quit();
_sslWebserver->thread()->wait(1000); _sslWebserver->thread()->wait(1000);
_sslWebserver->deleteLater();
_sslWebserver->thread()->deleteLater();
// stop Hyperions (non blocking) // stop Hyperions (non blocking)
_instanceManager->stopAll(); _instanceManager->stopAll();
@ -221,8 +235,6 @@ void HyperionDaemon::startNetworkServices()
QThread *fbThread = new QThread(this); QThread *fbThread = new QThread(this);
_flatBufferServer->moveToThread(fbThread); _flatBufferServer->moveToThread(fbThread);
connect(fbThread, &QThread::started, _flatBufferServer, &FlatBufferServer::initServer); connect(fbThread, &QThread::started, _flatBufferServer, &FlatBufferServer::initServer);
connect(fbThread, &QThread::finished, _flatBufferServer, &QObject::deleteLater);
connect(fbThread, &QThread::finished, fbThread, &QObject::deleteLater);
connect(this, &HyperionDaemon::settingsChanged, _flatBufferServer, &FlatBufferServer::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _flatBufferServer, &FlatBufferServer::handleSettingsUpdate);
fbThread->start(); fbThread->start();
@ -231,8 +243,6 @@ void HyperionDaemon::startNetworkServices()
QThread *pThread = new QThread(this); QThread *pThread = new QThread(this);
_protoServer->moveToThread(pThread); _protoServer->moveToThread(pThread);
connect(pThread, &QThread::started, _protoServer, &ProtoServer::initServer); connect(pThread, &QThread::started, _protoServer, &ProtoServer::initServer);
connect(pThread, &QThread::finished, _protoServer, &QObject::deleteLater);
connect(pThread, &QThread::finished, pThread, &QObject::deleteLater);
connect(this, &HyperionDaemon::settingsChanged, _protoServer, &ProtoServer::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _protoServer, &ProtoServer::handleSettingsUpdate);
pThread->start(); pThread->start();
@ -241,8 +251,6 @@ void HyperionDaemon::startNetworkServices()
QThread *wsThread = new QThread(this); QThread *wsThread = new QThread(this);
_webserver->moveToThread(wsThread); _webserver->moveToThread(wsThread);
connect(wsThread, &QThread::started, _webserver, &WebServer::initServer); connect(wsThread, &QThread::started, _webserver, &WebServer::initServer);
connect(wsThread, &QThread::finished, _webserver, &QObject::deleteLater);
connect(wsThread, &QThread::finished, wsThread, &QObject::deleteLater);
connect(this, &HyperionDaemon::settingsChanged, _webserver, &WebServer::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _webserver, &WebServer::handleSettingsUpdate);
wsThread->start(); wsThread->start();
@ -251,8 +259,6 @@ void HyperionDaemon::startNetworkServices()
QThread *sslWsThread = new QThread(this); QThread *sslWsThread = new QThread(this);
_sslWebserver->moveToThread(sslWsThread); _sslWebserver->moveToThread(sslWsThread);
connect(sslWsThread, &QThread::started, _sslWebserver, &WebServer::initServer); connect(sslWsThread, &QThread::started, _sslWebserver, &WebServer::initServer);
connect(sslWsThread, &QThread::finished, _sslWebserver, &QObject::deleteLater);
connect(sslWsThread, &QThread::finished, sslWsThread, &QObject::deleteLater);
connect(this, &HyperionDaemon::settingsChanged, _sslWebserver, &WebServer::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _sslWebserver, &WebServer::handleSettingsUpdate);
sslWsThread->start(); sslWsThread->start();
@ -261,8 +267,6 @@ void HyperionDaemon::startNetworkServices()
QThread *ssdpThread = new QThread(this); QThread *ssdpThread = new QThread(this);
_ssdp->moveToThread(ssdpThread); _ssdp->moveToThread(ssdpThread);
connect(ssdpThread, &QThread::started, _ssdp, &SSDPHandler::initServer); connect(ssdpThread, &QThread::started, _ssdp, &SSDPHandler::initServer);
connect(ssdpThread, &QThread::finished, _ssdp, &QObject::deleteLater);
connect(ssdpThread, &QThread::finished, ssdpThread, &QObject::deleteLater);
connect(_webserver, &WebServer::stateChange, _ssdp, &SSDPHandler::handleWebServerStateChange); connect(_webserver, &WebServer::stateChange, _ssdp, &SSDPHandler::handleWebServerStateChange);
connect(this, &HyperionDaemon::settingsChanged, _ssdp, &SSDPHandler::handleSettingsUpdate); connect(this, &HyperionDaemon::settingsChanged, _ssdp, &SSDPHandler::handleSettingsUpdate);
ssdpThread->start(); ssdpThread->start();