From d2fec8f612735943e2df6278d754bb3b7072d217 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 5 Sep 2013 13:38:56 +0200 Subject: [PATCH] Fixed thread handling. --- channels/printer/client/printer_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index 3826b7c3a..b3b17fb04 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -200,6 +200,8 @@ static void* printer_thread_func(void* arg) printer_process_irp(printer_dev, irp); } + ExitThread(0); + return NULL; } @@ -219,11 +221,14 @@ static void printer_free(DEVICE* device) SetEvent(printer_dev->stopEvent); WaitForSingleObject(printer_dev->thread, INFINITE); - CloseHandle(printer_dev->thread); while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL) irp->Discard(irp); + CloseHandle(printer_dev->thread); + CloseHandle(printer_dev->stopEvent); + CloseHandle(printer_dev->event); + _aligned_free(printer_dev->pIrpList); if (printer_dev->printer)