Skip to content

Commit

Permalink
Merge pull request #370 from zomfg/hotfix/nogui-crash
Browse files Browse the repository at this point in the history
nogui crash
  • Loading branch information
psieg authored Jul 12, 2020
2 parents 3a085dd + 2afa425 commit 1907cf1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
14 changes: 8 additions & 6 deletions Software/src/LightpackApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void LightpackApplication::initializeAll(const QString & appDirPath)

initGrabManager();

if (!m_noGui)
if (!m_noGui && m_settingsWindow)
{
connect(m_settingsWindow, SIGNAL(backlightStatusChanged(Backlight::Status)), this, SLOT(setStatusChanged(Backlight::Status)));
m_settingsWindow->startBacklight();
Expand Down Expand Up @@ -227,7 +227,7 @@ void LightpackApplication::setBacklightChanged(Lightpack::Mode mode)
{
DEBUG_LOW_LEVEL << Q_FUNC_INFO << mode;
Settings::setLightpackMode(mode);
if (!m_noGui)
if (!m_noGui && m_settingsWindow)
m_settingsWindow->setModeChanged(mode);

// In ApiPersist mode, we keep the colors left behind by API until the Backlight is restarted by some action
Expand Down Expand Up @@ -704,7 +704,7 @@ void LightpackApplication::initGrabManager()
m_moodlampManager->initFromSettings();

#ifdef SOUNDVIZ_SUPPORT
m_soundManager = SoundManagerBase::create(m_settingsWindow->winId(), NULL);
m_soundManager = SoundManagerBase::create((!m_noGui && m_settingsWindow) ? m_settingsWindow->winId() : 0, NULL);
if (m_soundManager)
m_soundManager->initFromSettings();
else
Expand Down Expand Up @@ -757,7 +757,7 @@ void LightpackApplication::initGrabManager()
#endif

// Connections to signals which will be connected to ILedDevice
if (!m_noGui)
if (!m_noGui && m_settingsWindow)
{
connect(m_settingsWindow, SIGNAL(showLedWidgets(bool)), this, SLOT(showLedWidgets(bool)));
connect(m_settingsWindow, SIGNAL(setColoredLedWidget(bool)), this, SLOT(setColoredLedWidget(bool)));
Expand All @@ -783,13 +783,15 @@ void LightpackApplication::initGrabManager()

connect(m_grabManager, SIGNAL(updateLedsColors(const QList<QRgb> &)), m_ledDeviceManager, SLOT(setColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_moodlampManager, SIGNAL(updateLedsColors(const QList<QRgb> &)), m_ledDeviceManager, SLOT(setColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_moodlampManager, SIGNAL(moodlampFrametime(const double)), m_settingsWindow, SLOT(refreshAmbilightEvaluated(double)), Qt::QueuedConnection);
if (!m_noGui && m_settingsWindow)
connect(m_moodlampManager, SIGNAL(moodlampFrametime(const double)), m_settingsWindow, SLOT(refreshAmbilightEvaluated(double)), Qt::QueuedConnection);
connect(m_ledDeviceManager, SIGNAL(openDeviceSuccess(bool)), m_grabManager, SLOT(ledDeviceOpenSuccess(bool)), Qt::QueuedConnection);
connect(m_ledDeviceManager, SIGNAL(ioDeviceSuccess(bool)), m_grabManager, SLOT(ledDeviceCallSuccess(bool)), Qt::QueuedConnection);
#ifdef SOUNDVIZ_SUPPORT
if (m_soundManager) {
connect(m_soundManager, SIGNAL(updateLedsColors(const QList<QRgb> &)), m_ledDeviceManager, SLOT(setColors(QList<QRgb>)), Qt::QueuedConnection);
connect(m_soundManager, SIGNAL(visualizerFrametime(const double)), m_settingsWindow, SLOT(refreshAmbilightEvaluated(double)), Qt::QueuedConnection);
if (!m_noGui && m_settingsWindow)
connect(m_soundManager, SIGNAL(visualizerFrametime(const double)), m_settingsWindow, SLOT(refreshAmbilightEvaluated(double)), Qt::QueuedConnection);
}
#endif
}
Expand Down
22 changes: 11 additions & 11 deletions Software/src/LightpackApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ private slots:
QMutex m_mutex;

private:
SettingsWindow *m_settingsWindow;
ApiServer *m_apiServer;
LedDeviceManager *m_ledDeviceManager;
QThread *m_ledDeviceManagerThread;
QThread *m_apiServerThread;
GrabManager *m_grabManager;
MoodLampManager *m_moodlampManager;
SettingsWindow *m_settingsWindow{nullptr};
ApiServer *m_apiServer{nullptr};
LedDeviceManager *m_ledDeviceManager{nullptr};
QThread *m_ledDeviceManagerThread{nullptr};
QThread *m_apiServerThread{nullptr};
GrabManager *m_grabManager{nullptr};
MoodLampManager *m_moodlampManager{nullptr};
#ifdef SOUNDVIZ_SUPPORT
SoundManagerBase *m_soundManager;
SoundManagerBase *m_soundManager{nullptr};
#endif

PluginsManager *m_pluginManager;
LightpackPluginInterface *m_pluginInterface;
QWidget *consolePlugin;
PluginsManager *m_pluginManager{nullptr};
LightpackPluginInterface *m_pluginInterface{nullptr};
QWidget *consolePlugin{nullptr};

QString m_applicationDirPath;
bool m_isDebugLevelObtainedFromCmdArgs;
Expand Down

0 comments on commit 1907cf1

Please sign in to comment.