]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 805147 ] GDI objects are not deselected from DC
authorJulian Smart <julian@anthemion.co.uk>
Fri, 12 Sep 2003 16:08:47 +0000 (16:08 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 12 Sep 2003 16:08:47 +0000 (16:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/bitmap.cpp

index 0e5ab48c9f1aaea1efd86178c43dce87a7400915..bac7a9c0cae9b7bacc37881131bc7189a0076316 100644 (file)
@@ -1910,8 +1910,8 @@ HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h)
         wxLogLastError(wxT("CreateBitmap"));
     }
 
-    ::SelectObject(hdcSrc, hbmpMask);
-    ::SelectObject(hdcDst, hbmpInvMask);
+    HGDIOBJ srcTmp = ::SelectObject(hdcSrc, hbmpMask);
+    HGDIOBJ dstTmp = ::SelectObject(hdcDst, hbmpInvMask);
     if ( !::BitBlt(hdcDst, 0, 0, w, h,
                    hdcSrc, 0, 0,
                    NOTSRCCOPY) )
@@ -1919,6 +1919,10 @@ HBITMAP wxInvertMask(HBITMAP hbmpMask, int w, int h)
         wxLogLastError(wxT("BitBlt"));
     }
 
+    // Deselect objects
+    SelectObject(hdcSrc,srcTmp);
+    SelectObject(hdcDst,dstTmp);
+    
     ::DeleteDC(hdcSrc);
     ::DeleteDC(hdcDst);