mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 17:30:20 +01:00
st/wgl: release the pbuffer DC at the end of wglBindTexImageARB()
Otherwise we were leaking DC GDI objects and if wglBindTexImageARB() was called enough we'd eventually hit the GDI limit of 10,000 objects. Things started failing at that point. v2: also release DC if we return early, per Charmaine. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
058c70bae1
commit
24004a2435
1 changed files with 6 additions and 1 deletions
|
|
@ -104,6 +104,7 @@ BOOL WINAPI
|
|||
wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
|
||||
{
|
||||
HDC prevDrawable = stw_get_current_dc();
|
||||
HDC dc;
|
||||
struct stw_context *curctx = stw_current_context();
|
||||
struct stw_framebuffer *fb;
|
||||
GLenum texFormat, srcBuffer, target;
|
||||
|
|
@ -164,10 +165,12 @@ wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
|
|||
*/
|
||||
pixelFormatSave = fb->iPixelFormat;
|
||||
fb->iPixelFormat = curctx->iPixelFormat;
|
||||
retVal = stw_make_current(wglGetPbufferDCARB(hPbuffer), curctx->dhglrc);
|
||||
dc = wglGetPbufferDCARB(hPbuffer);
|
||||
retVal = stw_make_current(dc, curctx->dhglrc);
|
||||
fb->iPixelFormat = pixelFormatSave;
|
||||
if (!retVal) {
|
||||
debug_printf("stw_make_current(#1) failed in wglBindTexImageARB()\n");
|
||||
wglReleasePbufferDCARB(hPbuffer, dc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -181,6 +184,8 @@ wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
|
|||
debug_printf("stw_make_current(#2) failed in wglBindTexImageARB()\n");
|
||||
}
|
||||
|
||||
wglReleasePbufferDCARB(hPbuffer, dc);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue