From 9731795e625b1e6a4990befd33241fd26a47e169 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Tue, 6 Jul 2021 17:01:48 +0200 Subject: [PATCH] Solve deadlock in startup between ErrorLogModel and AudioManager --- src/audiomanager.cpp | 3 +++ src/errorlogmodel.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audiomanager.cpp b/src/audiomanager.cpp index 6b5b41db..a01bdd90 100644 --- a/src/audiomanager.cpp +++ b/src/audiomanager.cpp @@ -17,6 +17,7 @@ #include "audiologging.h" #include "datamanager.h" +#include "errorlogmodel.h" #include "feed.h" #include "powermanagementinterface.h" #include "settingsmanager.h" @@ -73,6 +74,8 @@ AudioManager::AudioManager(QObject *parent) connect(&DataManager::instance(), &DataManager::queueEntryRemoved, this, &AudioManager::canGoNextChanged); // we'll send custom seekableChanged signal to work around QMediaPlayer glitches + connect(this, &AudioManager::logError, &ErrorLogModel::instance(), &ErrorLogModel::monitorErrorMessages); + // Check if an entry was playing when the program was shut down and restore it if (DataManager::instance().lastPlayingEntry() != QStringLiteral("none")) { setEntry(DataManager::instance().getEntry(DataManager::instance().lastPlayingEntry())); diff --git a/src/errorlogmodel.cpp b/src/errorlogmodel.cpp index 7acfa233..fa2f2a7c 100644 --- a/src/errorlogmodel.cpp +++ b/src/errorlogmodel.cpp @@ -8,7 +8,6 @@ #include -#include "audiomanager.h" #include "database.h" #include "datamanager.h" #include "fetcher.h" @@ -17,7 +16,6 @@ ErrorLogModel::ErrorLogModel() : QAbstractListModel(nullptr) { connect(&Fetcher::instance(), &Fetcher::error, this, &ErrorLogModel::monitorErrorMessages); - connect(&AudioManager::instance(), &AudioManager::logError, this, &ErrorLogModel::monitorErrorMessages); QSqlQuery query; query.prepare(QStringLiteral("SELECT * FROM Errors ORDER BY date DESC;"));