[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue May 24 13:54:37 PDT 2011


 sc/source/core/tool/rangelst.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 226c30f2a6cdb5be63b62f0d65577bf6550f3fa8
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue May 24 15:49:55 2011 -0400

    fdo#37520: Don't cache the array size but query it dynamically.
    
    The size of the array may change during the loop, so we need to always
    query it dynamically via size() instead of caching it at the beginning
    of the loop.
    
    Signed-off-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 0a92d63..572472e 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -260,7 +260,9 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
     }
     bool bJoinedInput = false;
 
-    for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges && pOver; ++i )
+    // We need to query the size of the container dynamically since its size
+    // may change during the loop.
+    for ( size_t i = 0; i < maRanges.size() && pOver; ++i )
     {
         ScRange* p = maRanges[i];
         if ( p == pOver )


More information about the Libreoffice-commits mailing list