Fix macOS filesystem listener (library watcher)
This commit is contained in:
parent
0308a3f9a5
commit
30413767cb
|
@ -24,10 +24,11 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QTimer>
|
||||
|
||||
#include "filesystemwatcherinterface.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
class MacFSListener : public FileSystemWatcherInterface {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -56,7 +57,7 @@ class MacFSListener : public FileSystemWatcherInterface {
|
|||
FSEventStreamRef stream_;
|
||||
|
||||
QSet<QString> paths_;
|
||||
QTimer update_timer_;
|
||||
QTimer *update_timer_;
|
||||
};
|
||||
|
||||
#endif // CORE_MACFSLISTENER_H_
|
||||
|
|
|
@ -22,14 +22,16 @@
|
|||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSString.h>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/scoped_nsobject.h"
|
||||
|
||||
MacFSListener::MacFSListener(QObject* parent)
|
||||
: FileSystemWatcherInterface(parent), run_loop_(nullptr), stream_(nullptr) {
|
||||
update_timer_.setSingleShot(true);
|
||||
update_timer_.setInterval(2000);
|
||||
connect(&update_timer_, SIGNAL(timeout()), SLOT(UpdateStream()));
|
||||
: FileSystemWatcherInterface(parent), run_loop_(nullptr), stream_(nullptr), update_timer_(new QTimer(this)) {
|
||||
update_timer_->setSingleShot(true);
|
||||
update_timer_->setInterval(2000);
|
||||
connect(update_timer_, SIGNAL(timeout()), SLOT(UpdateStream()));
|
||||
}
|
||||
|
||||
void MacFSListener::Init() { run_loop_ = CFRunLoopGetCurrent(); }
|
||||
|
@ -67,7 +69,7 @@ void MacFSListener::Clear() {
|
|||
UpdateStreamAsync();
|
||||
}
|
||||
|
||||
void MacFSListener::UpdateStreamAsync() { update_timer_.start(); }
|
||||
void MacFSListener::UpdateStreamAsync() { update_timer_->start(); }
|
||||
|
||||
void MacFSListener::UpdateStream() {
|
||||
if (stream_) {
|
||||
|
|
Loading…
Reference in New Issue