browser: refresh browser on database update properly

This commit is contained in:
Andrzej Rybczak
2015-04-12 19:17:54 +02:00
parent d1528ffc71
commit e30149d04c
8 changed files with 80 additions and 35 deletions

View File

@@ -31,6 +31,8 @@
namespace MPD {
void checkConnectionErrors(mpd_connection *conn);
enum PlayerState { psUnknown, psStop, psPlay, psPause };
enum ReplayGainMode { rgmOff, rgmTrack, rgmAlbum };
@@ -398,10 +400,17 @@ struct Iterator: std::iterator<std::input_iterator_tag, ObjectT>
// get the first element
++*this;
}
~Iterator()
{
if (m_state)
checkConnectionErrors(m_state->connection());
}
void finish()
{
// change the iterator into end iterator
assert(m_state);
// check errors and change the iterator into end iterator
checkConnectionErrors(m_state->connection());
m_state = nullptr;
}