summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-05-13 09:38:38 +0300
committerMichael Meeks <michael.meeks@collabora.com>2016-05-16 14:48:18 +0000
commit081b0f19b4f665a30e2209e805aebd2f25345d70 (patch)
tree85d670fe66dd7c5abd5e6473fa925d4c69126a60
parentd19b0fd3525aefd1c7d1b8b6564c77ffffede4e2 (diff)
tdf#97249: Don't crash if BindFont fails
For some reason, in this branch, when OpenGL is used, the code crashes when attempting to display a Writer document that uses a non-scalable font. With this change, instead of the crash, text in such a font simply doesn't show up. This of course is not acceptable either, but better than a crash. Change-Id: I702a48fe78f2bec303aa5682dde0035275a7bb26 Reviewed-on: https://gerrit.libreoffice.org/24946 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--vcl/win/source/gdi/winlayout.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 4dc79ea12943..c693085a693f 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -368,7 +368,12 @@ bool ImplWinFontEntry::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex
if (!pTxt)
return false;
- pTxt->BindFont(hDC);
+ if (!pTxt->BindFont(hDC))
+ {
+ SelectObject(hDC, hOrigFont);
+ DeleteDC(hDC);
+ return false;
+ }
// Bail for non-horizontal text.
{