summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorDon Hatch <dhatch@ilm.com>2012-12-05 06:07:03 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-06 17:32:24 (GMT)
commitfc27933affb49f70a8a5dc93dd7f4b2d105ccdfe (patch)
tree34ea34d173c67d6a2cda191b79bae033dc3a6c6f /src/opengl
parent92d2d2f24357339bd675a1174c20186174fc74f9 (diff)
downloadQt-fc27933affb49f70a8a5dc93dd7f4b2d105ccdfe.zip
Qt-fc27933affb49f70a8a5dc93dd7f4b2d105ccdfe.tar.gz
Qt-fc27933affb49f70a8a5dc93dd7f4b2d105ccdfe.tar.bz2
fix uninitialized has_brush,has_pen in QOpenGLPaintEnginePrivate
Fix probably-benign uninitialized memory reads of QOpenGLPaintEnginePrivate's member has_brush (if first call to updatePen() is before first call to updateBrush()) or has_pen (if the opposite). This makes the following error reported by valgrind 3.7.0 disappear: % valgrind --track-origins=yes --leak-check=no demos/composition/composition (press the "Use OpenGL" button) ... ==30137== Conditional jump or move depends on uninitialised value(s) ==30137== at 0x4C72CBD: QOpenGLPaintEnginePrivate::updateUseEmulation() (qpaintengine_opengl.cpp:2135) ==30137== by 0x4C76F2A: QOpenGLPaintEngine::updatePen(QPen const&) (qpaintengine_opengl.cpp:2145) ==30137== by 0x4C7708D: QOpenGLPaintEngine::penChanged() (qpaintengine_opengl.cpp:5416) ==30137== by 0x4C7C960: QOpenGLPaintEngine::begin(QPaintDevice*) (qpaintengine_opengl.cpp:1421) ==30137== by 0x5376BE7: QPainter::begin(QPaintDevice*) (qpainter.cpp:1881) ==30137== by 0x41B06F: ArthurFrame::paintEvent(QPaintEvent*) (arthurwidgets.cpp:149) ==30137== by 0x5223315: QWidget::event(QEvent*) (qwidget.cpp:8532) ==30137== Uninitialised value was created by a heap allocation ==30137== at 0x4A082CF: operator new(unsigned long) (vg_replace_malloc.c:287) ==30137== by 0x4C7736C: QOpenGLPaintEngine::QOpenGLPaintEngine() (qpaintengine_opengl.cpp:1234) ==30137== by 0x4C5171C: QGLEngineThreadStorage<QOpenGLPaintEngine>::engine() (qgl_p.h:939) ==30137== by 0x4C48E32: qt_qgl_paint_engine() (qgl.cpp:5333) ==30137== by 0x4C48E4E: QGLWidget::paintEngine() const (qgl.cpp:5345) ==30137== by 0x5376351: QPainter::begin(QPaintDevice*) (qpainter.cpp:1785) ==30137== by 0x41B06F: ArthurFrame::paintEvent(QPaintEvent*) (arthurwidgets.cpp:149) ==30137== by 0x5223315: QWidget::event(QEvent*) (qwidget.cpp:8532) ==30137== ... These members don't appear at all in the qt5 source, so I'm assuming this isn't an issue there. Therefore I'm submitting this fix directly, and only, to the qt 4.8 source, rather than putting it in qt5 first. (I wasn't able to get the composition demo program to exercise the opengl drawing code at all on qt5, so I can't say for sure whether qt5 is free of similar issues at this point.) Change-Id: Ic69beddd6e2c50b827140cb8790b40b9336c8f4e Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qpaintengine_opengl.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 9368b3b..a8c4d2b 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -654,6 +654,8 @@ public:
QOpenGLPaintEnginePrivate()
: opacity(1)
, composition_mode(QPainter::CompositionMode_SourceOver)
+ , has_pen(false)
+ , has_brush(false)
, has_fast_pen(false)
, use_stencil_method(false)
, dirty_drawable_texture(false)