summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-05-29 09:50:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-05-29 12:53:13 +0200
commita12633a9982d34eb8f0b714d5f25cff3040f33ab (patch)
tree0b048223d97641461fa7b4322737a06005b1a262 /vcl/unx/gtk3
parent4025ab7a19e730501877040814096c2fa47cefc3 (diff)
tdf#155515 tdf#155528 crash on exit
regression from commit 3b7db802731826b6cc3b55100470b0c61c1f2dfa Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu May 4 10:06:14 2023 +0200 tdf#105404 [API CHANGE] add index to accessiblity change event Fix a handful of things related to accessibility objects being destructed later than they should and consequently trying at access other stuff that has already been destructed. (1) AccessibleControlShape::disposing check the window still exists (2) DocumentFocusListener::notifyEvent, handle INVALIDATE_ALL_CHILDREN (3) hold DocumentFocusListener by weak reference in GtkSalData, so that it dies when the related UI widgets die Change-Id: I38bf68a748b37e6abc4a8cfcc961436728e081bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r--vcl/unx/gtk3/a11y/atkutil.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/vcl/unx/gtk3/a11y/atkutil.cxx b/vcl/unx/gtk3/a11y/atkutil.cxx
index b16648ecbf0e..fc15351374fd 100644
--- a/vcl/unx/gtk3/a11y/atkutil.cxx
+++ b/vcl/unx/gtk3/a11y/atkutil.cxx
@@ -162,8 +162,11 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj
}
case accessibility::AccessibleEventId::INVALIDATE_ALL_CHILDREN:
- SAL_INFO("vcl.a11y", "Invalidate all children called");
+ {
+ if (uno::Reference< accessibility::XAccessible > xAcc = getAccessible(aEvent))
+ detachRecursive(xAcc);
break;
+ }
default:
break;
@@ -433,13 +436,15 @@ WindowList g_aWindowList;
}
-DocumentFocusListener & GtkSalData::GetDocumentFocusListener()
+rtl::Reference<DocumentFocusListener> GtkSalData::GetDocumentFocusListener()
{
- if (!m_xDocumentFocusListener)
+ rtl::Reference<DocumentFocusListener> xDFL = m_xDocumentFocusListener.get();
+ if (!xDFL)
{
- m_xDocumentFocusListener = new DocumentFocusListener;
+ xDFL = new DocumentFocusListener;
+ m_xDocumentFocusListener = xDFL.get();
}
- return *m_xDocumentFocusListener;
+ return xDFL;
}
static void handle_get_focus(::VclWindowEvent const * pEvent)
@@ -447,7 +452,7 @@ static void handle_get_focus(::VclWindowEvent const * pEvent)
GtkSalData *const pSalData(GetGtkSalData());
assert(pSalData);
- DocumentFocusListener & rDocumentFocusListener(pSalData->GetDocumentFocusListener());
+ rtl::Reference<DocumentFocusListener> xDocumentFocusListener(pSalData->GetDocumentFocusListener());
vcl::Window *pWindow = pEvent->GetWindow();
@@ -493,7 +498,7 @@ static void handle_get_focus(::VclWindowEvent const * pEvent)
{
try
{
- rDocumentFocusListener.attachRecursive(xAccessible, xContext, nStateSet);
+ xDocumentFocusListener->attachRecursive(xAccessible, xContext, nStateSet);
}
catch (const uno::Exception&)
{