mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Create the FilesystemWatcherInterface directly in the LibraryWatcher, fixing a crash when trying to add a new device.
(cherry picked from commit d4b4606068
)
This commit is contained in:
parent
fd1c133e24
commit
ada7adcb2f
@ -20,7 +20,6 @@
|
||||
#include "librarymodel.h"
|
||||
#include "librarybackend.h"
|
||||
#include "core/database.h"
|
||||
#include "core/filesystemwatcherinterface.h"
|
||||
#include "smartplaylists/generator.h"
|
||||
#include "smartplaylists/querygenerator.h"
|
||||
#include "smartplaylists/search.h"
|
||||
@ -121,7 +120,6 @@ void Library::WatcherInitialised() {
|
||||
|
||||
watcher->set_backend(backend_);
|
||||
watcher->set_task_manager(task_manager_);
|
||||
watcher->set_filesystem_watcher(FileSystemWatcherInterface::Create());
|
||||
|
||||
connect(backend_, SIGNAL(DirectoryDiscovered(Directory,SubdirectoryList)),
|
||||
watcher, SLOT(AddDirectory(Directory,SubdirectoryList)));
|
||||
|
@ -49,7 +49,7 @@ LibraryWatcher::LibraryWatcher(QObject* parent)
|
||||
: QObject(parent),
|
||||
backend_(NULL),
|
||||
task_manager_(NULL),
|
||||
fs_watcher_(NULL),
|
||||
fs_watcher_(FileSystemWatcherInterface::Create(this)),
|
||||
stop_requested_(false),
|
||||
scan_on_startup_(true),
|
||||
monitor_(true),
|
||||
@ -695,9 +695,7 @@ void LibraryWatcher::ReloadSettings() {
|
||||
}
|
||||
|
||||
if (!monitor_ && was_monitoring_before) {
|
||||
if (fs_watcher_) {
|
||||
fs_watcher_->Clear();
|
||||
}
|
||||
fs_watcher_->Clear();
|
||||
} else if (monitor_ && !was_monitoring_before) {
|
||||
// Add all directories to all QFileSystemWatchers again
|
||||
foreach (const DirData& data, watched_dirs_.values()) {
|
||||
|
@ -44,7 +44,6 @@ class LibraryWatcher : public QObject {
|
||||
|
||||
void set_backend(LibraryBackend* backend) { backend_ = backend; }
|
||||
void set_task_manager(TaskManager* task_manager) { task_manager_ = task_manager; }
|
||||
void set_filesystem_watcher(FileSystemWatcherInterface* watcher) { fs_watcher_ = watcher; }
|
||||
void set_device_name(const QString& device_name) { device_name_ = device_name; }
|
||||
|
||||
void IncrementalScanAsync();
|
||||
|
Loading…
Reference in New Issue
Block a user