remove then dispose, not dispose then remove
asserts seen in inline spelling in calc otherwise
Change-Id: If78142cb0a3e23de6eb0e5d40622a4c7d06df8ec
Reviewed-on: https://gerrit.libreoffice.org/74512
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index f9ea736..b7876c1 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1495,6 +1495,10 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if (mpTempAccEdit)
{
mpTempAccEdit->LostFocus();
}
RemoveChild(mxTempAcc, true);
if (mpTempAccEdit)
{
// tdf#125982 a11y use-after-free of editengine by
// ScAccessibleEditObjectTextData living past the
// the editengine of the editview passed in above
@@ -1502,7 +1506,6 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
mpTempAccEdit->dispose();
mpTempAccEdit = nullptr;
}
RemoveChild(mxTempAcc, true);
if (mpAccessibleSpreadsheet.is() && mpViewShell && mpViewShell->IsActive())
mpAccessibleSpreadsheet->GotFocus();
else if( mpViewShell && mpViewShell->IsActive())