From 5f6f915a3a2f5739717bdda62c432cf9b484b11e Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sat, 19 Dec 2009 00:20:13 +0100 Subject: [PATCH] switch from selected items adder to old screen if db was updated not doing so inctroduces a very obscure bug: db update forces modification of browser, media library etc by clearing them and letting theirs Update() function populate them. but since selected items adder is active at the moment, this function is never called and we end up trying to add songs from screen that is empty, which in most cases leads to an out_of_range exception being thrown. --- src/status.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/status.cpp b/src/status.cpp index e45db1fb..2490526b 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -30,6 +30,7 @@ #include "helpers.h" #include "lyrics.h" #include "media_library.h" +#include "misc.h" #include "outputs.h" #include "playlist.h" #include "playlist_editor.h" @@ -309,6 +310,7 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *) } if (myPlaylistEditor->Main()) myPlaylistEditor->Content->Clear(); + changed.DBUpdating = 1; } if (changed.PlayerState) { @@ -524,6 +526,11 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *) if (Mpd.Version() < 14 || Mpd.Version() > 15) mpd_db_updating = Mpd.GetDBIsUpdating() ? 'U' : 0; ShowMessage(Mpd.GetDBIsUpdating() ? "Database update finished!" : "Database update started!"); + if (changed.Database && myScreen == mySelectedItemsAdder) + { + myScreen->SwitchTo(); // switch to previous screen + ShowMessage("Database has changed, you need to select your item(s) once again!"); + } } if (changed.StatusFlags && (Config.header_visibility || Config.new_design)) {