[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - vcl/source
Caolán McNamara
caolanm at redhat.com
Mon Jun 19 11:00:56 UTC 2017
vcl/source/gdi/CommonSalLayout.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit be9724dbe6513985c6a3b387490db2ccea9b8b4a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 16 12:35:34 2017 +0100
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 at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit ceb6b00e3d861825dd59c8b565b122c2eadfb2cb)
Reviewed-on: https://gerrit.libreoffice.org/38954
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
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;
More information about the Libreoffice-commits
mailing list