[Libreoffice-commits] core.git: accessibility/source

Caolán McNamara caolanm at redhat.com
Thu May 15 08:52:41 PDT 2014


 accessibility/source/extended/textwindowaccessibility.cxx |   15 +++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f5dae84979db977febaa06acaf5e6ceeee5afbf8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 15 16:49:40 2014 +0100

    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

diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index ad19eaf..052aac6 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;
     }
 }
 


More information about the Libreoffice-commits mailing list