diff options
author | Justin Luth <justin_luth@sil.org> | 2019-07-23 13:53:21 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-07-30 07:17:13 +0200 |
commit | a9f4913f283d34c610c4b73c755fdc828857bfce (patch) | |
tree | a040b9fa822f09888bb2553d13dcbfdd20b1ddb4 | |
parent | 6f8a1b6736b4a79778fd222c7adabb2f6a12ca0a (diff) |
tdf#125609 c14: vcl button: don't modify style directly
LO 6.4/6.3 commit d35171456bc230efdaa9426da1398b2db7fa0df8
could cause a recursive loop. ImplInitStyle RETURNS the
suggested style, while ImplUncheckAll MODIFYS the
actual style. Since the call to set WB_TABSTOP
was already redundant in this case (and many others),
I provided an option to avoid that direct modification.
An example crashing document is attached to the bug report,
which will eventually find its way into automatic crash testing.
For this particular example document, it also requires
LO 6.4 commit 5cf057c3365a0feafc8f2e4f4a9e24d69a581999
in order to trigger a crash.
Change-Id: I26dddca27471dec10650f848f787363505b16c0f
Reviewed-on: https://gerrit.libreoffice.org/76186
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | include/vcl/button.hxx | 2 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 2a63e47a8c9b..4e782aa7a437 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -297,7 +297,7 @@ private: const Size& rImageSize, tools::Rectangle& rStateRect, tools::Rectangle& rMouseRect ); SAL_DLLPRIVATE void ImplDrawRadioButton(vcl::RenderContext& rRenderContext ); - SAL_DLLPRIVATE void ImplUncheckAllOther(); + SAL_DLLPRIVATE void ImplUncheckAllOther( const bool bSetStyle = true); SAL_DLLPRIVATE Size ImplGetRadioImageSize() const; SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 6e0e70346215..5f6194e52bd5 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1855,7 +1855,7 @@ WinBits RadioButton::ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nSty nStyle |= WB_TABSTOP; if ( IsChecked() && IsRadioCheckEnabled() ) - ImplUncheckAllOther(); + ImplUncheckAllOther( /*bSetStyle=*/false ); return nStyle; } @@ -2243,9 +2243,10 @@ std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bInclud return aGroup; } -void RadioButton::ImplUncheckAllOther() +void RadioButton::ImplUncheckAllOther( const bool bSetStyle ) { - mpWindowImpl->mnStyle |= WB_TABSTOP; + if ( bSetStyle ) + mpWindowImpl->mnStyle |= WB_TABSTOP; std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false)); // iterate over radio button group and checked buttons |