From 7b13c0d05969a273d8211b94c99c67036ab0b7fa Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 2 Aug 2019 23:58:47 +0200 Subject: [PATCH] Fix watching new subdirs in collection watcher --- src/collection/collectionwatcher.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/collection/collectionwatcher.cpp b/src/collection/collectionwatcher.cpp index 8559f6a56..f331be721 100644 --- a/src/collection/collectionwatcher.cpp +++ b/src/collection/collectionwatcher.cpp @@ -143,15 +143,7 @@ CollectionWatcher::ScanTransaction::~ScanTransaction() { // If we're stopping then don't commit the transaction if (!watcher_->stop_requested_) { - CommitNewOrUpdatedSongs(); - - if (watcher_->monitor_) { - // Watch the new subdirectories - for (const Subdirectory &subdir : new_subdirs) { - watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path); - } - } } watcher_->task_manager_->SetTaskFinished(task_id_); @@ -196,7 +188,6 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() { if (!new_subdirs.isEmpty()) { emit watcher_->SubdirsDiscovered(new_subdirs); - new_subdirs.clear(); } if (!touched_subdirs.isEmpty()) { @@ -204,6 +195,15 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() { touched_subdirs.clear(); } + if (watcher_->monitor_) { + // Watch the new subdirectories + for (const Subdirectory &subdir : new_subdirs) { + watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path); + } + } + + new_subdirs.clear(); + }