From fb0f58f50f30116fc72ca0e8d0fbea1331052c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Fri, 2 Nov 2012 13:59:04 +0100 Subject: Fix conditional jump based on an uninitialized variable. Valgrind warns about the jump in qfontconfigdatabase.cpp:522 based on uint QFondDef::hintingPreference:2 property. Surprising thing is that the property is initialized in the default constructor, so there should not be an issue. The warning disappear if the property is _not_ placed on a boundary of a two words, or if bit field is fully initialized. So I suspect that only one bit of the two was initialized properly. I decide to implement both solutions because of a potential minor performance improvement, during reading the property. I still fail to say why the value was uninitialized, I believe that this patch simply workarounds gcc bug or valgrind bug. Change-Id: I2e87738f66a435ef6e30b3d2db6baa73da025426 Reviewed-by: Jiang Jiang Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt --- src/gui/text/qfont_p.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 2a37b56d87..ad8ba0758f 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -73,7 +73,8 @@ struct QFontDef : pointSize(-1.0), pixelSize(-1), styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle), weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100), - ignorePitch(true), hintingPreference(QFont::PreferDefaultHinting) + hintingPreference(QFont::PreferDefaultHinting), ignorePitch(true), + fixedPitchComputed(0), reserved(0) { } @@ -93,8 +94,8 @@ struct QFontDef uint style : 2; uint stretch : 12; // 0-400 - uint ignorePitch : 1; uint hintingPreference : 2; + uint ignorePitch : 1; uint fixedPitchComputed : 1; // for Mac OS X only int reserved : 14; // for future extensions -- cgit v1.2.3