changeset 970:b00943f21392

We need to destroy the thread's brush and pen when the thread exits so we don't leak objects on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 05 May 2011 17:14:24 +0000
parents 69f620df0c47
children 2a21915684d1
files win/dw.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Thu May 05 05:53:56 2011 +0000
+++ b/win/dw.c	Thu May 05 17:14:24 2011 +0000
@@ -9409,6 +9409,8 @@
 {
    void (* threadfunc)(void *) = NULL;
    void **tmp = (void **)data;
+   HPEN hPen;
+   HBRUSH hBrush;
 
    _init_thread();
 
@@ -9416,6 +9418,10 @@
    threadfunc(tmp[1]);
 
    free(tmp);
+   if((hPen = TlsGetValue(_hPen)))
+       DeleteObject(hPen);
+   if((hBrush = TlsGetValue(_hBrush)))
+       DeleteObject(hBrush);
 }
 
 /*