diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2014-11-28 13:59:38 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2014-11-30 11:15:09 +0000 |
commit | ef8e38266b13800518830917a71dde4d3ee8f7ef (patch) | |
tree | 114edd0d02a5853b0cd359748102a9980d7d5eeb | |
parent | 61672791db2fa5650b7021639bcaacfc534c75b5 (diff) |
fdo#86117 a11y: Exception when closing popup from ToolBox w/o separator
For some reason PopupWindowControllerImpl::WindowEventListener is getting
the VCLEVENT_WINDOW_HIDE event twice, and while processing the second one
the ToolBox no longer has an active down item, which results in a
IndexOutOfBoundsException in VCLXAccessibleToolBox::getAccessibleChild,
because ToolBox::GetItemPos(0) correctly returns TOOLBOX_ITEM_NOTFOUND.
But when a ToolBox has at least one separator, ToolBox::GetItemPos(0)
"detects" its position as the current down item, and no exception is
thrown.
Probably it just hides the bug, because it seems to me that getting
the hide event twice is the real bug here.
Change-Id: If018350dd91cd959c0c8f7d6859474f95fb8cd1e
Reviewed-on: https://gerrit.libreoffice.org/13173
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolbox.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 188e7772d920..c3042fbe67a4 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -430,10 +430,16 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); if( pWindow && pToolBox ) { + const sal_uInt16 nDownItem = pToolBox->GetDownItemId(); + if ( !nDownItem ) + // Items with ItemId == 0 are not allowed in ToolBox, which means that currently no item is in down state. + // Moreover, running GetItemPos with 0 could find a separator item if there is any. + return; + Reference< XAccessible > xChild( pWindow->GetAccessible() ); if( xChild.is() ) { - Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( pToolBox->GetDownItemId() ) ) ) ); + Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( nDownItem ) ) ) ); VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() ); pItem->SetChild( xChild ); |