Use self.* in callback to update and close watcher (#97)

onchange callback sets this to the reported FSEvent rather than the
outer FSWatcher
This commit is contained in:
Brendan Forster 2019-03-23 12:48:46 -03:00 коммит произвёл Shelley Vohr
Родитель fcaf11a29c
Коммит 7658ffaaa3
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -1380,10 +1380,10 @@ function FSWatcher() {
// after the handle is closed, and to fire both UV_RENAME and UV_CHANGE
// if they are set by libuv at the same time.
if (status < 0) {
if (this._handle !== null) {
if (self._handle !== null) {
// We don't use this.close() here to avoid firing the close event.
this._handle.close();
this._handle = null; // make the handle garbage collectable
self._handle.close();
self._handle = null; // make the handle garbage collectable
}
const error = errors.uvException({
errno: status,