Commit 55d74eb4 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Fix of HBITMAP leak in GAPI driver by Dmitry Yakimov.

 Fixes Bugzilla #371.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402247
parent cafb1ab2
...@@ -1178,7 +1178,7 @@ static void GAPI_WinPAINT(_THIS, HDC hdc) ...@@ -1178,7 +1178,7 @@ static void GAPI_WinPAINT(_THIS, HDC hdc)
// draw current offscreen buffer on hdc // draw current offscreen buffer on hdc
int bpp = 16; // we always use either 8 or 16 bpp internally int bpp = 16; // we always use either 8 or 16 bpp internally
HGDIOBJ prevObject;
unsigned short *bitmapData; unsigned short *bitmapData;
HBITMAP hb; HBITMAP hb;
HDC srcDC; HDC srcDC;
...@@ -1216,10 +1216,11 @@ static void GAPI_WinPAINT(_THIS, HDC hdc) ...@@ -1216,10 +1216,11 @@ static void GAPI_WinPAINT(_THIS, HDC hdc)
// FIXME: prevent misalignment, but I've never seen non aligned width of screen // FIXME: prevent misalignment, but I've never seen non aligned width of screen
memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage); memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage);
srcDC = CreateCompatibleDC(hdc); srcDC = CreateCompatibleDC(hdc);
SelectObject(srcDC, hb); prevObject = SelectObject(srcDC, hb);
BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY); BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY);
SelectObject(srcDC, prevObject);
DeleteObject(hb); DeleteObject(hb);
DeleteDC(srcDC); DeleteDC(srcDC);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment