Make sure schedule playlist save timer is started from correct thread
This commit is contained in:
@@ -2057,7 +2057,7 @@ void MainWindow::EditTagDialogAccepted() {
|
|||||||
// FIXME: This is really lame but we don't know what rows have changed.
|
// FIXME: This is really lame but we don't know what rows have changed.
|
||||||
ui_->playlist->view()->update();
|
ui_->playlist->view()->update();
|
||||||
|
|
||||||
app_->playlist_manager()->current()->ScheduleSave();
|
app_->playlist_manager()->current()->ScheduleSaveAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ void Playlist::ItemReloadComplete(const QPersistentModelIndex &idx, const Song &
|
|||||||
if (metadata_edit) {
|
if (metadata_edit) {
|
||||||
emit EditingFinished(id_, idx);
|
emit EditingFinished(id_, idx);
|
||||||
}
|
}
|
||||||
ScheduleSave();
|
ScheduleSaveAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1429,7 +1429,18 @@ void Playlist::SetCurrentIsPaused(const bool paused) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::ScheduleSave() const {
|
void Playlist::ScheduleSaveAsync() {
|
||||||
|
|
||||||
|
if (QThread::currentThread() == thread()) {
|
||||||
|
ScheduleSave();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
metaObject()->invokeMethod(this, "ScheduleSave", Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Playlist::ScheduleSave() {
|
||||||
|
|
||||||
if (!backend_ || is_loading_) return;
|
if (!backend_ || is_loading_) return;
|
||||||
|
|
||||||
@@ -1437,7 +1448,7 @@ void Playlist::ScheduleSave() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::Save() const {
|
void Playlist::Save() {
|
||||||
|
|
||||||
if (!backend_ || is_loading_) return;
|
if (!backend_ || is_loading_) return;
|
||||||
|
|
||||||
@@ -2240,7 +2251,7 @@ void Playlist::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &
|
|||||||
if (item && item->Metadata() == song && (!item->Metadata().art_manual_is_valid() || (result.type == AlbumCoverLoaderResult::Type_ManuallyUnset && !item->Metadata().has_manually_unset_cover()))) {
|
if (item && item->Metadata() == song && (!item->Metadata().art_manual_is_valid() || (result.type == AlbumCoverLoaderResult::Type_ManuallyUnset && !item->Metadata().has_manually_unset_cover()))) {
|
||||||
qLog(Debug) << "Updating art manual for local song" << song.title() << song.album() << song.title() << "to" << result.album_cover.cover_url << "in playlist.";
|
qLog(Debug) << "Updating art manual for local song" << song.title() << song.album() << song.title() << "to" << result.album_cover.cover_url << "in playlist.";
|
||||||
item->SetArtManual(result.album_cover.cover_url);
|
item->SetArtManual(result.album_cover.cover_url);
|
||||||
ScheduleSave();
|
ScheduleSaveAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ class Playlist : public QAbstractListModel {
|
|||||||
static bool set_column_value(Song &song, Column column, const QVariant &value);
|
static bool set_column_value(Song &song, Column column, const QVariant &value);
|
||||||
|
|
||||||
// Persistence
|
// Persistence
|
||||||
void ScheduleSave() const;
|
|
||||||
void Restore();
|
void Restore();
|
||||||
|
void ScheduleSaveAsync();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
QSortFilterProxyModel *proxy() const;
|
QSortFilterProxyModel *proxy() const;
|
||||||
@@ -383,7 +383,8 @@ class Playlist : public QAbstractListModel {
|
|||||||
void ItemReloadComplete(const QPersistentModelIndex &idx, const Song &old_metadata, const bool metadata_edit);
|
void ItemReloadComplete(const QPersistentModelIndex &idx, const Song &old_metadata, const bool metadata_edit);
|
||||||
void ItemsLoaded();
|
void ItemsLoaded();
|
||||||
void SongInsertVetoListenerDestroyed();
|
void SongInsertVetoListenerDestroyed();
|
||||||
void Save() const;
|
void ScheduleSave();
|
||||||
|
void Save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_loading_;
|
bool is_loading_;
|
||||||
|
|||||||
Reference in New Issue
Block a user