summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-15 16:49:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-15 16:52:08 +0100
commitf5dae84979db977febaa06acaf5e6ceeee5afbf8 (patch)
tree9fdd528c02fdf5875af49e36b5ee0caec19a65dd /accessibility
parenta0b9dbde60d1888842a04392045dac26bd79b60f (diff)
fix cut and paste into macro editor crash
e.g. select all in macro editor in virtualbox and paste into Linux macro editor and explode in debugging iterator land. regression due to IA2 integration of efb23f29983f87104a684e7fab00b84fc59d131d Change-Id: Ic7a4e9f5455f4ba3eaf0afd38fd5e445d6dc28e6
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index ad19eafbdf16..052aac68c822 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -2219,15 +2219,24 @@ void Document::handleParagraphNotifications()
void Document::sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventId)
{
- Paragraphs::iterator aEnd = ::std::min(m_xParagraphs->begin() + end + 1, m_aVisibleEnd);
- for (Paragraphs::iterator aIt = ::std::max(m_xParagraphs->begin() + start, m_aVisibleBegin);
- aIt < aEnd; ++aIt)
+ size_t nAvailDistance = std::distance(m_xParagraphs->begin(), m_aVisibleEnd);
+
+ Paragraphs::iterator aEnd(m_xParagraphs->begin());
+ size_t nEndDistance = std::min<size_t>(end + 1, nAvailDistance);
+ std::advance(aEnd, nEndDistance);
+
+ Paragraphs::iterator aIt(m_xParagraphs->begin());
+ size_t nStartDistance = std::min<size_t>(start, nAvailDistance);
+ std::advance(aIt, nStartDistance);
+
+ while (aIt < aEnd)
{
::rtl::Reference< Paragraph > xParagraph(getParagraph(aIt));
if (xParagraph.is())
xParagraph->notifyEvent(
nEventId,
::css::uno::Any(), ::css::uno::Any());
+ ++aIt;
}
}