From d6e117e1d8b1b39311a5042fde762c475e884326 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 24 Nov 2014 06:53:02 +0400 Subject: Don't remember if passed HFONT was a stock object According to GetStockObject() function docs at MSDN: > It is not necessary (but it is not harmful) to delete > stock objects by calling DeleteObject. Change-Id: I755dc84c8b86ba2806e97ae41b3025aa3e633ae7 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase.cpp') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index c5fd910fb0..724d0e7aaf 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1675,7 +1675,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); - bool stockFont = false; bool preferClearTypeAA = false; HFONT hfont = 0; @@ -1696,7 +1695,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, if (!hfont) qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); - stockFont = (hfont == 0); bool ttf = false; int avWidth = 0; BOOL res; @@ -1720,15 +1718,11 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, } #ifndef Q_OS_WINCE - if (hfont == 0) { + if (hfont == 0) hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); - stockFont = true; - } #else - if (hfont == 0) { + if (hfont == 0) hfont = (HFONT)GetStockObject(SYSTEM_FONT); - stockFont = true; - } #endif } @@ -1762,7 +1756,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, QFontEngine *fe = 0; if (!useDirectWrite) { - QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, stockFont, lf, data); + QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, lf, data); if (preferClearTypeAA) few->glyphFormat = QFontEngine::Format_A32; few->initFontInfo(request, dpi); -- cgit v1.2.3