While calling OnFileCreated(), we should not release the FileMonitor
instance. If it's deleted, it causes the crash issue.
Change-Id: I203db1fec079f705d3f6008944f0c8f3848cb04d
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
if (monitor->file_name_ != event->name) continue;
- if (event->mask & IN_CREATE)
+ if (event->mask & IN_CREATE) {
listener->OnFileCreated(monitor->path_);
- else if (event->mask & IN_DELETE)
+ return G_SOURCE_CONTINUE;
+ }
+
+ if (event->mask & IN_DELETE)
listener->OnFileDeleted(monitor->path_);
}
}
void Proxy::Cancel() {
std::lock_guard<std::recursive_mutex> lock(GetMutex());
- file_monitor_.reset();
+ if (!file_monitor_) return;
+
+ file_monitor_->Stop();
}
void Proxy::SetRealAppId(const std::string& alias_appid) {