diff options
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolbox.cxx | 11 | ||||
-rw-r--r-- | vcl/source/window/accessibility.cxx | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index d52d26b95d73..9094ce357b6b 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -630,9 +630,14 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal if ( pItemWindow ) { Reference< XAccessible> xParent = xChild; - rtl::Reference<OToolBoxWindowItem> xChild2( new OToolBoxWindowItem(0,::comphelper::getProcessComponentContext(),pItemWindow->GetAccessible(),xParent) ); - pItemWindow->SetAccessible(xChild2); - xChild->SetChild( xChild2 ); + auto const xInnerAcc(pItemWindow->GetAccessible()); + if (xInnerAcc) // else child is being disposed - avoid crashing + { + rtl::Reference<OToolBoxWindowItem> xChild2(new OToolBoxWindowItem(0, + ::comphelper::getProcessComponentContext(), xInnerAcc, xParent)); + pItemWindow->SetAccessible(xChild2); + xChild->SetChild( xChild2 ); + } } if ( nHighlightItemId > ToolBoxItemId(0) && nItemId == nHighlightItemId ) xChild->SetFocus( true ); diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 3c6103ac31d9..295a5c3878fc 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -69,7 +69,7 @@ css::uno::Reference< css::accessibility::XAccessible > Window::GetAccessible( bo */ if ( !mpWindowImpl ) return css::uno::Reference< css::accessibility::XAccessible >(); - if ( !mpWindowImpl->mxAccessible.is() && bCreate ) + if (!mpWindowImpl->mxAccessible.is() && !mpWindowImpl->mbInDispose && bCreate) mpWindowImpl->mxAccessible = CreateAccessible(); return mpWindowImpl->mxAccessible; |