diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-09 14:16:20 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-05-09 20:42:22 +0200 |
commit | 5e99e5d734f19fe7299a3e390b23a93db971e013 (patch) | |
tree | 582fa341cbb5ba5bd8ebab9042e0c56cec667601 /sw | |
parent | b7affedf9c281d6329ac87c5f3cd0fd0f617acbb (diff) |
Resolves: tdf#138512 don't crash on removing already Disposed a11y context
Change-Id: I2a8f3d10a1349de233e11d841f7f244e4e513b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151582
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/acccontext.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/access/acccontext.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/accmap.cxx | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index 37cb87fb3114..3445114b2d78 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -518,9 +518,14 @@ bool SwAccessibleContext::IsEditableState() return bRet; } +bool SwAccessibleContext::IsDisposed() const +{ + return !(GetFrame() && GetMap()); +} + void SwAccessibleContext::ThrowIfDisposed() { - if (!(GetFrame() && GetMap())) + if (IsDisposed()) { throw lang::DisposedException("object is nonfunctional", static_cast<cppu::OWeakObject*>(this)); diff --git a/sw/source/core/access/acccontext.hxx b/sw/source/core/access/acccontext.hxx index 32d13efbf513..d64939089622 100644 --- a/sw/source/core/access/acccontext.hxx +++ b/sw/source/core/access/acccontext.hxx @@ -349,6 +349,8 @@ public: virtual bool SetSelectedState(bool bSelected); bool IsSelectedInDoc() const { return m_isSelectedInDoc; } + bool IsDisposed() const; + static OUString GetResource(TranslateId pResId, const OUString *pArg1 = nullptr, const OUString *pArg2 = nullptr); diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index fe0384ca0ea2..5cc2fd73801b 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2673,7 +2673,9 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrame *pFrame ) for (SwAccessibleParagraph* pAccPara : m_setParaRemove) { - if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0) + if (pAccPara && !pAccPara->IsDisposed() && + pAccPara->getSelectedAccessibleChildCount() == 0 && + pAccPara->getSelectedText().getLength() == 0) { if(pAccPara->SetSelectedState(false)) { |