Skip to content

Commit

Permalink
Fix of HBITMAP leak in GAPI driver by Dmitry Yakimov.
Browse files Browse the repository at this point in the history
 Fixes Bugzilla #371.
  • Loading branch information
icculus committed Dec 11, 2006
1 parent 2013951 commit 5d26e7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/video/gapi/SDL_gapivideo.c
Expand Up @@ -1178,7 +1178,7 @@ static void GAPI_WinPAINT(_THIS, HDC hdc)
// 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;
Expand Down Expand Up @@ -1216,10 +1216,11 @@ static void GAPI_WinPAINT(_THIS, HDC hdc)
// 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);
}
Expand Down

0 comments on commit 5d26e7b

Please sign in to comment.