diff options
Diffstat (limited to 'dep/efsw/src/efsw/FileWatcherWin32.cpp')
| -rw-r--r-- | dep/efsw/src/efsw/FileWatcherWin32.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/dep/efsw/src/efsw/FileWatcherWin32.cpp b/dep/efsw/src/efsw/FileWatcherWin32.cpp index 37f43cc27da..1dd96aa7945 100644 --- a/dep/efsw/src/efsw/FileWatcherWin32.cpp +++ b/dep/efsw/src/efsw/FileWatcherWin32.cpp @@ -26,7 +26,8 @@ FileWatcherWin32::~FileWatcherWin32() { removeAllWatches(); - CloseHandle( mIOCP ); + if ( mIOCP ) + CloseHandle( mIOCP ); } WatchID FileWatcherWin32::addWatch( const std::string& directory, FileWatchListener* watcher, @@ -112,7 +113,7 @@ void FileWatcherWin32::removeWatch( WatcherStructWin32* watch ) { void FileWatcherWin32::watch() { if ( NULL == mThread ) { - mThread = new Thread( &FileWatcherWin32::run, this ); + mThread = new Thread([this]{run();}); mThread->launch(); } } @@ -143,7 +144,8 @@ void FileWatcherWin32::run() { break; } else { Lock lock( mWatchesLock ); - WatchCallback( numOfBytes, ov ); + if (mWatches.find( (WatcherStructWin32*)ov ) != mWatches.end()) + WatchCallback( numOfBytes, ov ); } } } else { |
