summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-11-28 13:59:38 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2014-12-02 14:26:49 +0200
commit13f5ccd98ee7c623d5d4a53da56df668f98f7353 (patch)
tree3c57c37c8d9394fe672ca4b169cfa78c5d7dc878 /accessibility
parent33a088fbc46409fa2963613e3ac28b181164e647 (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> (cherry picked from commit ef8e38266b13800518830917a71dde4d3ee8f7ef)
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx8
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 );