Fix segfault when removing feeds with currently playing entries

This commit is contained in:
Swapnil Tripathi 2021-05-22 09:05:33 +00:00 committed by Bart De Vries
parent 2eb1092f46
commit 21e9d0b9a7
2 changed files with 6 additions and 0 deletions

View File

@ -237,6 +237,8 @@ void AudioManager::setEntry(Entry *entry)
DataManager::instance().setLastPlayingEntry(QStringLiteral("none"));
d->m_entry = nullptr;
Q_EMIT entryChanged(nullptr);
d->m_player.stop();
d->m_player.setMedia(nullptr);
d->m_readyToPlay = false;
Q_EMIT durationChanged(0);
Q_EMIT positionChanged(0);

View File

@ -8,6 +8,7 @@
#include "database.h"
#include "fetcher.h"
#include "settingsmanager.h"
#include "audiomanager.h"
#include <QDateTime>
#include <QDir>
#include <QSqlDatabase>
@ -252,6 +253,9 @@ void DataManager::removeFeed(const int index)
qDebug() << "delete queueentries of" << feedurl;
for (auto &id : m_queuemap) {
if (getEntry(id)->feed()->url() == feedurl) {
if(AudioManager::instance().entry() == getEntry(id)) {
AudioManager::instance().next();
}
removeQueueItem(id);
}
}