From f919cc6c0dd6bbb114256f4d80a4205ef8c63122 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 22 Jul 2005 13:24:40 +0000 Subject: Ensure DCs are emptied of non-stock, non-default objects before they are released to keep BoundsChecker happy. --- win32/PlatWin.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index c902104fd..c59ac388b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1543,7 +1543,7 @@ void ListBoxX::Paint(HDC hDC) { Point extent = GetClientExtent(); HBITMAP hBitmap = ::CreateCompatibleBitmap(hDC, extent.x, extent.y); HDC bitmapDC = ::CreateCompatibleDC(hDC); - SelectBitmap(bitmapDC, hBitmap); + HBITMAP hBitmapOld = SelectBitmap(bitmapDC, hBitmap); // The list background is mainly erased during painting, but can be a small // unpainted area when at the end of a non-integrally sized list with a // vertical scroll bar @@ -1552,6 +1552,9 @@ void ListBoxX::Paint(HDC hDC) { // Paint the entire client area and vertical scrollbar ::SendMessage(lb, WM_PRINT, reinterpret_cast(bitmapDC), PRF_CLIENT|PRF_NONCLIENT); ::BitBlt(hDC, 0, 0, extent.x, extent.y, bitmapDC, 0, 0, SRCCOPY); + // Select a stock brush to prevent warnings from BoundsChecker + ::SelectObject(bitmapDC, GetStockFont(WHITE_BRUSH)); + SelectBitmap(bitmapDC, hBitmapOld); ::DeleteDC(bitmapDC); ::DeleteObject(hBitmap); } -- cgit v1.2.3