You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidFileWatcherWin32::run() {
do {
if ( mInitOK && !mWatches.empty() ) {
DWORD numOfBytes = 0;
OVERLAPPED* ov = NULL;
ULONG_PTR compKey = 0;
BOOL res = FALSE;
while ( ( res = GetQueuedCompletionStatus( mIOCP, &numOfBytes, &compKey, &ov,
INFINITE ) ) != FALSE ) {
if ( compKey != 0 && compKey == reinterpret_cast<ULONG_PTR>( this ) ) {
break;
} else {
Lock lock( mWatchesLock );
WatchCallback( numOfBytes, ov );
}
}
if GetQueuedCompletionStatus is ok, and than will call Lock lock( mWatchesLock );.
but before call it, user call removeWatch, then WatchCallback will access null pointer.
The text was updated successfully, but these errors were encountered:
I think you're right. Sorry, this is very old code, I should review it again.
if GetQueuedCompletionStatus is ok, and than will call Lock lock( mWatchesLock );.
but before call it, user call removeWatch, then WatchCallback will access null pointer.
You're correct, after the lock it should check that the overlapped object is still available.
I'll fix them next week since I don't have access to a Windows machine right now and I would like to test the fix.
memory leak doubt:
at WatcherWin32.cpp.
CreateWatch use below code.
DestroyWatch use below code.
this do not HeapFree pWatch.
Is it may leak memory?
Thread conflict:
at FileWatcherWin32.cpp.
if GetQueuedCompletionStatus is ok, and than will call
Lock lock( mWatchesLock );
.but before call it, user call removeWatch, then WatchCallback will access null pointer.
The text was updated successfully, but these errors were encountered: