wininet: When sending INTERNET_STATUS_HANDLE_CLOSING make sure the freed handle is not yet available.

This commit is contained in:
Misha Koshelev 2007-09-21 21:27:48 -05:00 committed by Alexandre Julliard
parent 665a8add92
commit 705b01c054
1 changed files with 11 additions and 3 deletions

View File

@ -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;
}