tdf#163697: avoid premature handling of following notifications
This avoids re-entry to Document::handleParagraphNotifications, which already was known to be problematic (see comments in Document::Notify, and m_bSelectionChangedNotification introduced to avoid one such case). Change-Id: I9e0b451f13ad109d08b1afc9cc0346cd6049b026 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175879 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
parent
15eb26d0f2
commit
9a07b6c34c
@ -572,6 +572,7 @@ private:
|
|||||||
|
|
||||||
std::queue< ::TextHint > m_aParagraphNotifications;
|
std::queue< ::TextHint > m_aParagraphNotifications;
|
||||||
bool m_bSelectionChangedNotification;
|
bool m_bSelectionChangedNotification;
|
||||||
|
bool m_bInParagraphNotificationsHandler = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1670,6 +1670,16 @@ Document::changeParagraphText(::sal_uInt32 nNumber, ::sal_uInt16 nBegin, ::sal_u
|
|||||||
|
|
||||||
void Document::handleParagraphNotifications()
|
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())
|
while (!m_aParagraphNotifications.empty())
|
||||||
{
|
{
|
||||||
::TextHint aHint(m_aParagraphNotifications.front());
|
::TextHint aHint(m_aParagraphNotifications.front());
|
||||||
@ -1856,6 +1866,7 @@ void Document::handleParagraphNotifications()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_bInParagraphNotificationsHandler = false;
|
||||||
if (m_bSelectionChangedNotification)
|
if (m_bSelectionChangedNotification)
|
||||||
{
|
{
|
||||||
m_bSelectionChangedNotification = false;
|
m_bSelectionChangedNotification = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user