summaryrefslogtreecommitdiff
path: root/winaccessibility
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-04-16 20:03:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-04-16 21:32:07 +0200
commitd492d1bfeb484ab8b627948449f488b2738946aa (patch)
tree09cb1a01fba4fabead2f3e468884f1961241af9f /winaccessibility
parent2963c0f0305bca04e7028f207df7fb4070d2aa33 (diff)
VCLXAccessibleComponent* may be passed to HandleWindowOpened
my_sc_impl::AccessBridgeHandleExistingWindow may do that for combobox floating window; then using the pointer statically cast to VCLXWindow* will crash. Change-Id: Ib4c47715a5fa059aa81f33137cc3d10851a728e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92387 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'winaccessibility')
-rw-r--r--winaccessibility/source/service/AccTopWindowListener.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx
index 9a3071086324..76aee9ae8333 100644
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <vcl/window.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/sysdata.hxx>
@@ -53,8 +54,12 @@ using namespace cppu;
void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* pAccessible )
{
//get SystemData from window
- VCLXWindow* pvclwindow = static_cast<VCLXWindow*>(pAccessible);
- auto window = pvclwindow->GetWindow();
+ VclPtr<vcl::Window> window;
+ if (auto pvclwindow = dynamic_cast<VCLXWindow*>(pAccessible))
+ window = pvclwindow->GetWindow();
+ else if (auto pvclxcomponent = dynamic_cast<VCLXAccessibleComponent*>(pAccessible))
+ window = pvclxcomponent->GetWindow();
+ assert(window);
// The SalFrame of window may be destructed at this time
const SystemEnvData* systemdata = nullptr;
try