]> git.lyx.org Git - features.git/commitdiff
Remove spurious error "QFileSystemWatcher::removePath: path is empty"
authorGuillaume MM <gm@lyx.org>
Sun, 30 Apr 2017 22:02:10 +0000 (00:02 +0200)
committerGuillaume MM <gm@lyx.org>
Mon, 1 May 2017 17:31:42 +0000 (19:31 +0200)
src/support/FileMonitor.cpp

index f1446a3aba6bde7175e769f1b80cef960b1cfadc..30a4170ed53b6ca8808ba5e6fd2bf304435123cd 100644 (file)
@@ -100,6 +100,8 @@ FileMonitorGuard::FileMonitorGuard(string const & filename,
                                    QFileSystemWatcher * qwatcher)
        : filename_(filename), qwatcher_(qwatcher), exists_(true)
 {
+       if (filename.empty())
+               return;
        QObject::connect(qwatcher, SIGNAL(fileChanged(QString const &)),
                         this, SLOT(notifyChange(QString const &)));
        if (qwatcher_->files().contains(toqstr(filename)))
@@ -111,12 +113,15 @@ FileMonitorGuard::FileMonitorGuard(string const & filename,
 
 FileMonitorGuard::~FileMonitorGuard()
 {
-       qwatcher_->removePath(toqstr(filename_));
+       if (!filename_.empty())
+               qwatcher_->removePath(toqstr(filename_));
 }
 
 
 void FileMonitorGuard::refresh()
 {
+       if (filename_.empty())
+               return;
        QString const qfilename = toqstr(filename_);
        if(!qwatcher_->files().contains(qfilename)) {
                bool exists = QFile(qfilename).exists();