riched20: Fix some GDI object leaks.
Dmitry Timoshkov
dmitry at baikal.ru
Sat Jan 28 06:27:03 CST 2012
This patch should fix the problem reported in the bug 22256.
---
dlls/riched20/richole.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 8e90204..fa19855 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1644,9 +1644,12 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
switch (stgm.tymed)
{
case TYMED_GDI:
+ {
+ HBITMAP old_bitmap;
+
GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
hMemDC = CreateCompatibleDC(c->hDC);
- SelectObject(hMemDC, stgm.u.hBitmap);
+ old_bitmap = SelectObject(hMemDC, stgm.u.hBitmap);
if (has_size)
{
convert_sizel(c, &run->ole_obj->sizel, &sz);
@@ -1669,8 +1672,11 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
hMemDC, 0, 0, dibsect.dsBm.bmWidth,
dibsect.dsBm.bmHeight, SRCCOPY);
}
+ SelectObject(hMemDC, old_bitmap);
if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
+ DeleteDC(hMemDC);
break;
+ }
case TYMED_ENHMF:
GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
if (has_size)
--
1.7.8.4
More information about the wine-patches
mailing list