diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-16 12:35:34 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2017-06-19 13:00:30 +0200 |
commit | be9724dbe6513985c6a3b387490db2ccea9b8b4a (patch) | |
tree | f57601698664a442f46b64b0945c384a389cb517 | |
parent | 50bf861da91fabee45917358ed688e984c3e0e4b (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>
(cherry picked from commit ceb6b00e3d861825dd59c8b565b122c2eadfb2cb)
Reviewed-on: https://gerrit.libreoffice.org/38954
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 3 |
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; |