comparison win/dw.c @ 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 52cd98b7e45c
comparison
equal deleted inserted replaced
969:69f620df0c47 970:b00943f21392
9407 */ 9407 */
9408 void _dwthreadstart(void *data) 9408 void _dwthreadstart(void *data)
9409 { 9409 {
9410 void (* threadfunc)(void *) = NULL; 9410 void (* threadfunc)(void *) = NULL;
9411 void **tmp = (void **)data; 9411 void **tmp = (void **)data;
9412 HPEN hPen;
9413 HBRUSH hBrush;
9412 9414
9413 _init_thread(); 9415 _init_thread();
9414 9416
9415 threadfunc = (void (*)(void *))tmp[0]; 9417 threadfunc = (void (*)(void *))tmp[0];
9416 threadfunc(tmp[1]); 9418 threadfunc(tmp[1]);
9417 9419
9418 free(tmp); 9420 free(tmp);
9421 if((hPen = TlsGetValue(_hPen)))
9422 DeleteObject(hPen);
9423 if((hBrush = TlsGetValue(_hBrush)))
9424 DeleteObject(hBrush);
9419 } 9425 }
9420 9426
9421 /* 9427 /*
9422 * Creates a new thread with a starting point of func. 9428 * Creates a new thread with a starting point of func.
9423 * Parameters: 9429 * Parameters: