]> git.lyx.org Git - features.git/blobdiff - src/support/FileMonitor.cpp
Remove redundant declarations reported by GCC with -Wredundant-decls option
[features.git] / src / support / FileMonitor.cpp
index c703d2bba7480df28f7dafd3b067fb7e78cdcfe3..0af322d9eeabe2b4144fa568894a687c7e2b8a86 100644 (file)
@@ -59,7 +59,7 @@ FileSystemWatcher::getGuard(FileName const & filename)
 //static
 FileMonitorPtr FileSystemWatcher::monitor(FileName const & filename)
 {
-       return make_unique<FileMonitor>(instance().getGuard(filename));
+       return lyx::make_unique<FileMonitor>(instance().getGuard(filename));
 }
 
 
@@ -67,7 +67,7 @@ FileMonitorPtr FileSystemWatcher::monitor(FileName const & filename)
 ActiveFileMonitorPtr FileSystemWatcher::activeMonitor(FileName const & filename,
                                                       int interval)
 {
-       return make_unique<ActiveFileMonitor>(instance().getGuard(filename),
+       return lyx::make_unique<ActiveFileMonitor>(instance().getGuard(filename),
                                              filename, interval);
 }
 
@@ -176,29 +176,28 @@ FileMonitor::FileMonitor(std::shared_ptr<FileMonitorGuard> monitor)
 
 void FileMonitor::connectToFileMonitorGuard()
 {
+       // Connections need to be asynchronous because the receiver can own this
+       // object and therefore is allowed to delete it.
+       // Qt signal:
        QObject::connect(monitor_.get(), SIGNAL(fileChanged(bool)),
+                        this, SIGNAL(fileChanged(bool)),
+                        Qt::QueuedConnection);
+       // Boost signal:
+       QObject::connect(this, SIGNAL(fileChanged(bool)),
                         this, SLOT(changed(bool)));
 }
 
 
-signals2::connection FileMonitor::connect(slot const & slot)
+connection FileMonitor::connect(slot const & slot)
 {
        return fileChanged_.connect(slot);
 }
 
 
-void FileMonitor::disconnect()
-{
-       fileChanged_.disconnect_all_slots();
-       QObject::disconnect(this, SIGNAL(fileChanged(bool)));
-}
-
-
 void FileMonitor::changed(bool const exists)
 {
        // emit boost signal
        fileChanged_(exists);
-       Q_EMIT fileChanged(exists);
 }
 
 
@@ -244,7 +243,7 @@ void ActiveFileMonitor::checkModified()
                }
        }
        if (changed)
-               FileMonitor::changed(exists);
+               Q_EMIT FileMonitor::fileChanged(exists);
        QTimer::singleShot(interval_, this, SLOT(clearCooldown()));
 }