diff options
-rw-r--r-- | accessibility/inc/extended/textwindowaccessibility.hxx | 1 | ||||
-rw-r--r-- | accessibility/source/extended/textwindowaccessibility.cxx | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/accessibility/inc/extended/textwindowaccessibility.hxx b/accessibility/inc/extended/textwindowaccessibility.hxx index 44652bc87d3c..e998ac3c443e 100644 --- a/accessibility/inc/extended/textwindowaccessibility.hxx +++ b/accessibility/inc/extended/textwindowaccessibility.hxx @@ -572,6 +572,7 @@ private: std::queue< ::TextHint > m_aParagraphNotifications; bool m_bSelectionChangedNotification; + bool m_bInParagraphNotificationsHandler = false; }; } diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index ac8c0a736ab1..8692e5fcd0ff 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1670,6 +1670,16 @@ Document::changeParagraphText(::sal_uInt32 nNumber, ::sal_uInt16 nBegin, ::sal_u void Document::handleParagraphNotifications() { + // Recursion is possible, e.g. when SfxHintId::TextParaInserted is being handled, + // and TextEngine::GetTextHeight is called for the paragraph being inserted; that + // tries to handle the following SfxHintId::TextFormatPara notification at the + // moment when the respective element hasn't yet been inserted into m_aParagraphs, + // which could crash. Therefore, re-entry is not allowed. The handling is done in + // a loop anyway, so it will process all of them in due order. + // See also comments in Document::Notify. + if (m_bInParagraphNotificationsHandler) + return; + m_bInParagraphNotificationsHandler = true; while (!m_aParagraphNotifications.empty()) { ::TextHint aHint(m_aParagraphNotifications.front()); @@ -1856,6 +1866,7 @@ void Document::handleParagraphNotifications() break; } } + m_bInParagraphNotificationsHandler = false; if (m_bSelectionChangedNotification) { m_bSelectionChangedNotification = false; |