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.
This commit is contained in:
Andrzej Rybczak
2009-12-19 00:20:13 +01:00
parent 055cf43af3
commit 5f6f915a3a

View File

@@ -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))
{