Create the FilesystemWatcherInterface directly in the LibraryWatcher, fixing a crash when trying to add a new device.

This commit is contained in:
David Sansome 2012-01-08 18:37:46 +00:00
parent ff92815ef0
commit d4b4606068
3 changed files with 2 additions and 7 deletions

View File

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

View File

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

View File

@ -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();