Commit 705b01c0 authored by Misha Koshelev's avatar Misha Koshelev Committed by Alexandre Julliard

wininet: When sending INTERNET_STATUS_HANDLE_CLOSING make sure the freed handle…

wininet: When sending INTERNET_STATUS_HANDLE_CLOSING make sure the freed handle is not yet available.
parent 665a8add
......@@ -208,13 +208,14 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
TRACE( "destroying handle %d for object %p\n", handle+1, info);
WININET_Handles[handle] = NULL;
ret = TRUE;
if( WININET_dwNextHandle > handle )
WININET_dwNextHandle = handle;
}
}
LeaveCriticalSection( &WININET_cs );
/* As on native when the equivalent of WININET_Release is called, the handle
* is already invalid, but if a new handle is created at this time it does
* not yet get assigned the freed handle number */
if( info )
{
/* Free all children as native does */
......@@ -227,6 +228,13 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
WININET_Release( info );
}
EnterCriticalSection( &WININET_cs );
if( WININET_dwNextHandle > handle && !WININET_Handles[handle] )
WININET_dwNextHandle = handle;
LeaveCriticalSection( &WININET_cs );
return ret;
}
......@@ -1006,8 +1014,8 @@ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
return FALSE;
}
WININET_FreeHandle( hInternet );
WININET_Release( lpwh );
WININET_FreeHandle( hInternet );
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment