vcl/source/app/salvtables.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 563f7077f1dbce31ff95ee8d2e8d17b629693db1
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Wed Jan 10 19:30:17 2024 -0500
Commit:     Patrick Luby <plub...@libreoffice.org>
CommitDate: Sun Jan 14 12:52:16 2024 +0100

    tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
    
    rather than waiting for `m_xDrawingArea` to get disposed, to prevent
    unsafe use of the now potentially non-functional accessible until it
    gets disposed with the VclDrawingArea
    
    Change-Id: I5b8720ac4d5ed41cb1775b0142b17d198e9f036d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161903
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@libreoffice.org>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index bf76517fea68..7482a086b1be 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6340,6 +6340,19 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea()
     m_xDrawingArea->SetResizeHdl(Link<const Size&, void>());
     m_xDrawingArea->SetPaintHdl(
         Link<std::pair<vcl::RenderContext&, const tools::Rectangle&>, void>());
+
+    // tdf#159089 dispose custom accessible here and unset for `m_xDrawingArea`
+    // rather than waiting for `m_xDrawingArea` to get disposed, to prevent
+    // unsafe use of the now potentially non-functional accessible until it
+    // gets disposed with the VclDrawingArea
+    css::uno::Reference<css::accessibility::XAccessible> xAccessible
+        = m_xDrawingArea->GetAccessible();
+    css::uno::Reference<css::lang::XComponent> xComp(xAccessible, 
css::uno::UNO_QUERY);
+    if (xComp.is())
+    {
+        xComp->dispose();
+        m_xDrawingArea->SetAccessible(nullptr);
+    }
 }
 
 OutputDevice& SalInstanceDrawingArea::get_ref_device() { return 
*m_xDrawingArea->GetOutDev(); }

Reply via email to