[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue May 24 18:49:49 PDT 2011


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

New commits:
commit ab39bd917f36073e662bc2c71a882b2312566762
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 3f46ebd..25e06dc 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