summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-16 12:35:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-16 21:19:08 +0200
commitceb6b00e3d861825dd59c8b565b122c2eadfb2cb (patch)
tree55b2e63f01f83e73e52363bf19b633c83835c949
parent2e0b0d471417fb7b5bb7f2732ed6715822340438 (diff)
silence DrMemory warning about Selected font handle deleted
This might actually matter in practice given https://stackoverflow.com/questions/27422871/does-deletedc-automatically-unselect-objects "DCs get a default 1x1x1 bitmap when they're created. This will leak if you don't put it back." Change-Id: Ib2d361995621ad429277ff52cb8c9fdfc0009953 Reviewed-on: https://gerrit.libreoffice.org/38875 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 1a67243d38e0..54a8dc312398 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -53,13 +53,14 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
unsigned char* pBuffer = nullptr;
HFONT hFont = static_cast<HFONT>(pUserData);
HDC hDC = GetDC(nullptr);
- SelectObject(hDC, hFont);
+ HGDIOBJ hOrigFont = SelectObject(hDC, hFont);
nLength = ::GetFontData(hDC, OSL_NETDWORD(nTableTag), 0, nullptr, 0);
if (nLength > 0 && nLength != GDI_ERROR)
{
pBuffer = new unsigned char[nLength];
::GetFontData(hDC, OSL_NETDWORD(nTableTag), 0, pBuffer, nLength);
}
+ SelectObject(hDC, hOrigFont);
ReleaseDC(nullptr, hDC);
#elif defined(MACOSX) || defined(IOS)
unsigned char* pBuffer = nullptr;