From 27a110eb7238b8b8d72db968d813855a9c2afb08 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 31 Mar 2010 11:13:38 +0200 Subject: Fix crash when using qDebug() on a QBrush with Qt::TexturePattern style. Merge-request: 541 Reviewed-by: Benjamin Poulain --- src/gui/painting/qbrush.cpp | 3 ++- tests/auto/qbrush/tst_qbrush.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 1a83b1d..fcfc44d 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -989,7 +989,8 @@ QDebug operator<<(QDebug dbg, const QBrush &b) "LinearGradientPattern", "RadialGradientPattern", "ConicalGradientPattern", - "TexturePattern" + 0, 0, 0, 0, 0, 0, + "TexturePattern" // 24 }; dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')'; diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/qbrush/tst_qbrush.cpp index bc2bc60..cff45c2 100644 --- a/tests/auto/qbrush/tst_qbrush.cpp +++ b/tests/auto/qbrush/tst_qbrush.cpp @@ -75,9 +75,10 @@ private slots: void gradientStops(); void textures(); - + void nullBrush(); void isOpaque(); + void debug(); }; Q_DECLARE_METATYPE(QBrush) @@ -390,5 +391,15 @@ void tst_QBrush::isOpaque() QVERIFY(!brush.isOpaque()); } +void tst_QBrush::debug() +{ + QPixmap pixmap_source(10, 10); + fill(&pixmap_source); + QBrush pixmap_brush; + pixmap_brush.setTexture(pixmap_source); + QCOMPARE(pixmap_brush.style(), Qt::TexturePattern); + qDebug() << pixmap_brush; // don't crash +} + QTEST_MAIN(tst_QBrush) #include "tst_qbrush.moc" -- cgit v0.12