[Libreoffice-commits] core.git: winaccessibility/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 16 19:32:41 UTC 2020


 winaccessibility/source/service/AccTopWindowListener.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit d492d1bfeb484ab8b627948449f488b2738946aa
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Apr 16 20:03:35 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Apr 16 21:32:07 2020 +0200

    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 at collabora.com>

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


More information about the Libreoffice-commits mailing list