From d7cb2fd44b7801799401dca343014bbf53ad130c Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 8 Jul 2016 14:10:34 +0200 Subject: [PATCH] QMacStyle::styleHint - test pixmap sizes styleHint for SH_FocusFrame_Mask calls drawControl with a painter created for pixmap. We only test pixmapSize.isValid(), but the size (0,0) is also 'isValid', and we end up with a QPainter with an invalid paintEngine (null) crashing in drawControl. Task-number: QTBUG-54630 Change-Id: I84d1785f04ffb3e608812076a6d1bc36ffb92adc Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 18ba2f45f5..3352c5d589 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2961,7 +2961,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w QImage img; QSize pixmapSize = opt->rect.size(); - if (pixmapSize.isValid()) { + if (!pixmapSize.isEmpty()) { QPixmap pix(pixmapSize); pix.fill(QColor(fillR, fillG, fillB)); QPainter pix_paint(&pix);