diff options
author | Herbert Dürr <hdu@apache.org> | 2013-03-21 15:27:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-10 09:46:56 +0100 |
commit | c2cb5f47f04cfce498943bad08d18b891c680f19 (patch) | |
tree | fd33d2c1944ec1200351e0e5bf228b3dc5da593d /vcl/aqua | |
parent | 064457db3ede211d3130f42c9dfaa17ea24a6aa5 (diff) |
Related: #i112873# check native widget's control value type...
before converting to SpinbuttonValue or ScrollbarValue
Else problems like #i112873# or even crashes can and do happen.
(cherry picked from commit d2fde1d34c3c28572b1b6b4780269c15dd4c2bef)
Conflicts:
vcl/unx/kde/salnativewidgets-kde.cxx
Change-Id: I6429205ab41b3194577bc50aa02384c920e11ed2
Diffstat (limited to 'vcl/aqua')
-rw-r--r-- | vcl/aqua/source/gdi/salnativewidgets.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 8e2ef02b3bac..3365c0457b13 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -805,7 +805,7 @@ sal_Bool AquaSalGraphics::drawNativeControl(ControlType nType, case CTRL_SCROLLBAR: { - ScrollbarValue* pScrollbarVal = (ScrollbarValue *)&aValue; + const ScrollbarValue* pScrollbarVal = (aValue.getType() == CTRL_SCROLLBAR) ? static_cast<const ScrollbarValue*>(&aValue) : NULL; if( nPart == PART_DRAW_BACKGROUND_VERT || nPart == PART_DRAW_BACKGROUND_HORZ ) @@ -1025,16 +1025,13 @@ sal_Bool AquaSalGraphics::drawNativeControl(ControlType nType, if(nState & CTRL_STATE_FOCUSED) HIThemeDrawFocusRect(&rc, true, mrContext, kHIThemeOrientationNormal); //buttons: - SpinbuttonValue* pSpinButtonVal = (SpinbuttonValue *)&aValue; + const SpinbuttonValue* pSpinButtonVal = (aValue.getType() == CTRL_SPINBUTTONS) ? static_cast<const SpinbuttonValue*>(&aValue) : NULL; ControlState nUpperState = CTRL_STATE_ENABLED;//state of the upper button ControlState nLowerState = CTRL_STATE_ENABLED;//and of the lower button if(pSpinButtonVal) {//pSpinButtonVal is sometimes null nUpperState = (ControlState) pSpinButtonVal->mnUpperState; nLowerState = (ControlState) pSpinButtonVal->mnLowerState; - } - if( pSpinButtonVal ) - { HIThemeButtonDrawInfo aSpinInfo; aSpinInfo.kind = kThemeIncDecButton; aSpinInfo.state = kThemeStateActive; |