# HG changeset patch # User Ryan C. Gordon # Date 1165866679 0 # Node ID aa07730d792fdc4b68125186e0098134209102b5 # Parent 3a7248359cdd2c898d09769391635bca5b3ebde2 Fix of HBITMAP leak in GAPI driver by Dmitry Yakimov. Fixes Bugzilla #371. diff -r 3a7248359cdd -r aa07730d792f src/video/gapi/SDL_gapivideo.c --- a/src/video/gapi/SDL_gapivideo.c Fri Dec 01 20:26:06 2006 +0000 +++ b/src/video/gapi/SDL_gapivideo.c Mon Dec 11 19:51:19 2006 +0000 @@ -1178,7 +1178,7 @@ // draw current offscreen buffer on hdc int bpp = 16; // we always use either 8 or 16 bpp internally - + HGDIOBJ prevObject; unsigned short *bitmapData; HBITMAP hb; HDC srcDC; @@ -1216,10 +1216,11 @@ // FIXME: prevent misalignment, but I've never seen non aligned width of screen memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage); srcDC = CreateCompatibleDC(hdc); - SelectObject(srcDC, hb); + prevObject = SelectObject(srcDC, hb); BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY); + SelectObject(srcDC, prevObject); DeleteObject(hb); DeleteDC(srcDC); }