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

Noel Power noelp at kemper.freedesktop.org
Wed May 25 02:13:21 PDT 2011


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

New commits:
commit 1cc716f1a64b21b9749c314c39a051b401dd32a7
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: Noel Power <noel.power at novell.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