Solve deadlock in startup between ErrorLogModel and AudioManager

This commit is contained in:
Bart De Vries 2021-07-06 17:01:48 +02:00
parent 6a4c6011d1
commit 9731795e62
2 changed files with 3 additions and 2 deletions

View File

@ -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()));

View File

@ -8,7 +8,6 @@
#include <QSqlQuery>
#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;"));