[Libreoffice-commits] core.git: accessibility/source
Maxim Monastirsky
momonasmon at gmail.com
Sun Nov 30 03:15:35 PST 2014
accessibility/source/standard/vclxaccessibletoolbox.cxx | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
New commits:
commit ef8e38266b13800518830917a71dde4d3ee8f7ef
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Nov 28 13:59:38 2014 +0200
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 at gmail.com>
Tested-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 188e777..c3042fb 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 );
More information about the Libreoffice-commits
mailing list