Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/winhttp/request.c | 14 ++++++++++++-- dlls/winhttp/session.c | 2 +- dlls/winhttp/winhttp_private.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 7cb07b5c10..e31803ccfe 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -138,6 +138,14 @@ static DWORD start_queue( struct queue *queue ) return ERROR_SUCCESS; }
+void stop_queue( struct queue *queue ) +{ + if (!queue->pool) return; + CloseThreadpool( queue->pool ); + queue->pool = NULL; + TRACE("stopped %p\n", queue); +} + static DWORD queue_task( struct queue *queue, PTP_WORK_CALLBACK task, void *ctx ) { TP_WORK *work; @@ -3037,8 +3045,8 @@ static void socket_destroy( struct object_header *hdr )
TRACE("%p\n", socket);
- if (socket->send_q.pool) CloseThreadpool( socket->send_q.pool ); - if (socket->recv_q.pool) CloseThreadpool( socket->recv_q.pool ); + stop_queue( &socket->send_q ); + stop_queue( &socket->recv_q );
release_object( &socket->request->hdr ); heap_free( socket ); @@ -3526,6 +3534,7 @@ static DWORD socket_shutdown( struct socket *socket, USHORT status, const void * struct netconn *netconn = socket->request->netconn; DWORD ret;
+ stop_queue( &socket->send_q ); if (!(ret = send_frame( netconn, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE ))) { socket->state = SOCKET_STATE_SHUTDOWN; @@ -3609,6 +3618,7 @@ static DWORD socket_close( struct socket *socket, USHORT status, const void *rea
if (socket->state < SOCKET_STATE_SHUTDOWN) { + stop_queue( &socket->send_q ); if ((ret = send_frame( netconn, SOCKET_OPCODE_CLOSE, status, reason, len, TRUE ))) goto done; socket->state = SOCKET_STATE_SHUTDOWN; } diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index f3ab8c9b95..080837eb1e 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -578,7 +578,7 @@ static void request_destroy( struct object_header *hdr )
TRACE("%p\n", request);
- if (request->queue.pool) CloseThreadpool( request->queue.pool ); + stop_queue( &request->queue ); release_object( &request->connect->hdr );
if (request->cred_handle_initialized) FreeCredentialsHandle( &request->cred_handle ); diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 9d0b9c308a..23aba00780 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -317,6 +317,7 @@ BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN; void close_connection( struct request * ) DECLSPEC_HIDDEN; +void stop_queue( struct queue * ) DECLSPEC_HIDDEN;
void netconn_close( struct netconn * ) DECLSPEC_HIDDEN; DWORD netconn_create( struct hostdata *, const struct sockaddr_storage *, int, struct netconn ** ) DECLSPEC_HIDDEN;