From 14655ba171a530707be80c4980af98668298cfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 17 Nov 2020 11:40:15 +0100 Subject: [PATCH 1/2] Don't handle sigsegv in order to allow generating core dumps --- nymea-networkmanager/application.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nymea-networkmanager/application.cpp b/nymea-networkmanager/application.cpp index 6a1ebd5..b5fb2a5 100644 --- a/nymea-networkmanager/application.cpp +++ b/nymea-networkmanager/application.cpp @@ -52,10 +52,6 @@ static void catchUnixSignals(const std::vector& quitSignals, const std::vec case SIGHUP: qCDebug(dcApplication()) << "Cought SIGHUP quit signal..."; break; - case SIGSEGV: { - qCCritical(dcApplication()) << "Cought SIGSEGV signal. Segmentation fault!"; - exit(EXIT_FAILURE); - } default: qCDebug(dcApplication()) << "Cought unhandled signal" << sig; break; @@ -87,5 +83,5 @@ static void catchUnixSignals(const std::vector& quitSignals, const std::vec Application::Application(int &argc, char **argv) : QCoreApplication(argc, argv) { - catchUnixSignals({SIGQUIT, SIGINT, SIGTERM, SIGHUP, SIGSEGV}); + catchUnixSignals({SIGQUIT, SIGINT, SIGTERM, SIGHUP}); } From 139d0957bf235a4563613b24fa674b6d967f00b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 17 Nov 2020 15:44:42 +0100 Subject: [PATCH 2/2] Update bluetooth server state changes and keep the order properly --- nymea-networkmanager/core.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nymea-networkmanager/core.cpp b/nymea-networkmanager/core.cpp index c8e9f16..19261d1 100644 --- a/nymea-networkmanager/core.cpp +++ b/nymea-networkmanager/core.cpp @@ -131,8 +131,8 @@ Core::Core(QObject *parent) : m_bluetoothServer = new BluetoothServer(m_networkManager); - connect(m_bluetoothServer, &BluetoothServer::runningChanged, this, &Core::onBluetoothServerRunningChanged); - connect(m_bluetoothServer, &BluetoothServer::connectedChanged, this, &Core::onBluetoothServerConnectedChanged); + connect(m_bluetoothServer, &BluetoothServer::runningChanged, this, &Core::onBluetoothServerRunningChanged, Qt::QueuedConnection); + connect(m_bluetoothServer, &BluetoothServer::connectedChanged, this, &Core::onBluetoothServerConnectedChanged, Qt::QueuedConnection); m_nymeaService = new NymeadService(false, this); connect(m_nymeaService, &NymeadService::availableChanged, this, &Core::onNymeaServiceAvailableChanged); @@ -192,9 +192,13 @@ void Core::evaluateNetworkManagerState(NetworkManager::NetworkManagerState state case NetworkManager::NetworkManagerStateAsleep: case NetworkManager::NetworkManagerStateDisconnected: case NetworkManager::NetworkManagerStateConnectedLocal: - // Everything else is not connected, start the service - qCDebug(dcApplication()) << "Start the bluetooth service because of \"offline\" mode."; - startService(); + if (m_networkManager->available()) { + // Everything else is not connected, start the service + qCDebug(dcApplication()) << "Start the bluetooth service because of \"offline\" mode."; + startService(); + } else { + qCDebug(dcApplication()) << "Not starting the service yet because the networkmanager is not available."; + } break; default: qCDebug(dcApplication()) << "Ignoring" << state; @@ -288,7 +292,6 @@ void Core::onBluetoothServerConnectedChanged(bool connected) if (!connected) { m_advertisingTimer->stop(); - m_bluetoothServer->stop(); } }