diff options
Diffstat (limited to 'Source/cmFileMonitor.cxx')
-rw-r--r-- | Source/cmFileMonitor.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index 41ec8b4..909be78 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -36,7 +36,7 @@ public: class cmVirtualDirectoryWatcher : public cmIBaseWatcher { public: - ~cmVirtualDirectoryWatcher() + ~cmVirtualDirectoryWatcher() override { for (auto i : this->Children) { delete i.second; @@ -156,7 +156,7 @@ public: p->AddChildWatcher(ps, this); } - ~cmRealDirectoryWatcher() + ~cmRealDirectoryWatcher() override { // Handle is freed via uv_handle_close callback! } @@ -247,7 +247,10 @@ public: void StopWatching() final {} - void AppendCallback(cmFileMonitor::Callback cb) { CbList.push_back(cb); } + void AppendCallback(cmFileMonitor::Callback const& cb) + { + this->CbList.push_back(cb); + } std::string Path() const final { @@ -288,7 +291,7 @@ void on_directory_change(uv_fs_event_t* handle, const char* filename, { const cmIBaseWatcher* const watcher = static_cast<const cmIBaseWatcher*>(handle->data); - const std::string pathSegment(filename); + const std::string pathSegment(filename ? filename : ""); watcher->Trigger(pathSegment, events, status); } @@ -310,7 +313,7 @@ cmFileMonitor::~cmFileMonitor() } void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, - Callback cb) + Callback const& cb) { for (const auto& p : paths) { std::vector<std::string> pathSegments; @@ -331,6 +334,9 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, rootSegment)); // Can not be both filename and root part of the path! const std::string& currentSegment = pathSegments[i]; + if (currentSegment.empty()) { + continue; + } cmIBaseWatcher* nextWatcher = currentWatcher->Find(currentSegment); if (!nextWatcher) { |