diff options
author | Morten Sorvig <msorvig@trolltech.com> | 2009-08-13 15:00:28 +0200 |
---|---|---|
committer | Morten Sorvig <msorvig@trolltech.com> | 2009-08-13 15:07:36 +0200 |
commit | c3687d0e59632dd97645ea3c67478437ba8adb5a (patch) | |
tree | 7f539a1c88344995703562ac0ebf69f41d5436c8 /src | |
parent | 9ae362b3b3341bfa09cab6992496b8d4af409d06 (diff) |
Fix crash/assert on Mac when painting "small" QPushButtons.
A QPushButton with a height if (say) three pixels would cause
HIThemeGetButtonContentBounds ot return a rect with dimentions
{int_min, int_min, 0, 0}. Detect that case and return the button
rect instead.
Reviewed-by: Trust Me
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 8d6b593bb..b2923f6da 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1020,6 +1020,13 @@ HIRect QMacStylePrivate::pushButtonContentBounds(const QStyleOptionButton *btn, HIRect contentBounds; HIThemeGetButtonContentBounds(&outerBounds, bdi, &contentBounds); + + // Return the button rect if the rect returned by HIThemeGetButtonContentBounds + // is invalid. This avoids passing around bad rects to code that does not expect it. + if (contentBounds.size.height == 0 && contentBounds.size.width == 0) { + return qt_hirectForQRect(btn->rect); + } + return contentBounds; } |