mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 16:02:20 +00:00
wininet: Track child handles, free all child handles on WININET_FreeHandle as native.
This commit is contained in:
parent
eecc57f104
commit
728e5fa559
|
@ -39,8 +39,6 @@
|
|||
#include "wine/debug.h"
|
||||
#include "internet.h"
|
||||
|
||||
#include "wine/list.h"
|
||||
|
||||
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
||||
|
||||
|
||||
|
|
|
@ -1128,6 +1128,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
|
|||
|
||||
WININET_AddRef( &lpwfs->hdr );
|
||||
lpwh->lpFtpSession = lpwfs;
|
||||
list_add_head( &lpwfs->hdr.children, &lpwh->hdr.entry );
|
||||
|
||||
handle = WININET_AllocHandle( &lpwh->hdr );
|
||||
if( !handle )
|
||||
|
@ -1904,6 +1905,7 @@ HINTERNET FTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
|
|||
|
||||
WININET_AddRef( &hIC->hdr );
|
||||
lpwfs->lpAppInfo = hIC;
|
||||
list_add_head( &hIC->hdr.children, &lpwfs->hdr.entry );
|
||||
|
||||
handle = WININET_AllocHandle( &lpwfs->hdr );
|
||||
if( !handle )
|
||||
|
@ -3012,6 +3014,7 @@ static HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONW lpwfs, INT nSocket, LP
|
|||
|
||||
WININET_AddRef( &lpwfs->hdr );
|
||||
lpwfn->lpFtpSession = lpwfs;
|
||||
list_add_head( &lpwfs->hdr.children, &lpwfn->hdr.entry );
|
||||
|
||||
handle = WININET_AllocHandle( &lpwfn->hdr );
|
||||
}
|
||||
|
|
|
@ -1371,6 +1371,7 @@ HINTERNET WINAPI HTTP_HttpOpenRequestW(LPWININETHTTPSESSIONW lpwhs,
|
|||
|
||||
WININET_AddRef( &lpwhs->hdr );
|
||||
lpwhr->lpHttpSession = lpwhs;
|
||||
list_add_head( &lpwhs->hdr.children, &lpwhr->hdr.entry );
|
||||
|
||||
handle = WININET_AllocHandle( &lpwhr->hdr );
|
||||
if (NULL == handle)
|
||||
|
@ -2824,6 +2825,7 @@ HINTERNET HTTP_Connect(LPWININETAPPINFOW hIC, LPCWSTR lpszServerName,
|
|||
|
||||
WININET_AddRef( &hIC->hdr );
|
||||
lpwhs->lpAppInfo = hIC;
|
||||
list_add_head( &hIC->hdr.children, &lpwhs->hdr.entry );
|
||||
|
||||
handle = WININET_AllocHandle( &lpwhs->hdr );
|
||||
if (NULL == handle)
|
||||
|
|
|
@ -105,6 +105,8 @@ HINTERNET WININET_AllocHandle( LPWININETHANDLEHEADER info )
|
|||
LPWININETHANDLEHEADER *p;
|
||||
UINT handle = 0, num;
|
||||
|
||||
list_init( &info->children );
|
||||
|
||||
EnterCriticalSection( &WININET_cs );
|
||||
if( !WININET_dwMaxHandles )
|
||||
{
|
||||
|
@ -182,6 +184,8 @@ BOOL WININET_Release( LPWININETHANDLEHEADER info )
|
|||
INTERNET_STATUS_HANDLE_CLOSING, &info->hInternet,
|
||||
sizeof(HINTERNET));
|
||||
TRACE( "destroying object %p\n", info);
|
||||
if ( info->htype != WH_HINIT )
|
||||
list_remove( &info->entry );
|
||||
info->destroy( info );
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -191,7 +195,7 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
|
|||
{
|
||||
BOOL ret = FALSE;
|
||||
UINT handle = (UINT) hinternet;
|
||||
LPWININETHANDLEHEADER info = NULL;
|
||||
LPWININETHANDLEHEADER info = NULL, child, next;
|
||||
|
||||
EnterCriticalSection( &WININET_cs );
|
||||
|
||||
|
@ -212,7 +216,16 @@ BOOL WININET_FreeHandle( HINTERNET hinternet )
|
|||
LeaveCriticalSection( &WININET_cs );
|
||||
|
||||
if( info )
|
||||
{
|
||||
/* Free all children as native does */
|
||||
LIST_FOR_EACH_ENTRY_SAFE( child, next, &info->children, WININETHANDLEHEADER, entry )
|
||||
{
|
||||
TRACE( "freeing child handle %d for parent handle %d\n",
|
||||
(UINT)child->hInternet, handle+1);
|
||||
WININET_FreeHandle( child->hInternet );
|
||||
}
|
||||
WININET_Release( info );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#endif
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_NETDB_H
|
||||
|
@ -149,6 +150,8 @@ struct _WININETHANDLEHEADER
|
|||
WININET_object_function close_connection;
|
||||
WININET_object_function destroy;
|
||||
INTERNET_STATUS_CALLBACK lpfnStatusCB;
|
||||
struct list entry;
|
||||
struct list children;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "shlobj.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
|
Loading…
Reference in a new issue