Skip to content

Commit

Permalink
avoid keep adding songs on playlist clear
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Jan 28, 2018
1 parent c4bf609 commit 718988e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gui/PlaylistModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ PlaylistModel::PlaylistModel(QObject *parent)
PlaylistModel::~PlaylistModel()
{
this->songsToAdd.shutDown=true;
this->songsToAdd.queue.clear();

try
{
Expand Down Expand Up @@ -414,10 +415,15 @@ void PlaylistModel::remove(size_t i)

void PlaylistModel::clear()
{
{
std::unique_lock<mutex> lck(this->songsToAdd.mtx);
this->songsToAdd.queue.clear();
// emit this->SongAdded("", 0, 0);
}

lock_guard<recursive_mutex> lck(this->mtx);

const int Elements = this->rowCount(QModelIndex());

this->removeRows(0, Elements);
}

Expand Down

0 comments on commit 718988e

Please sign in to comment.