← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Commit message:
Fixed bug #1154984 (windows build crashes if a vector iterator is reused after it is used to erase an element of the vector)

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/158110

Fixed bug #1154984 (windows build crashes if a vector iterator is reused after it is used to erase an element of the vector)
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/158110
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-04-10 10:13:31 +0000
+++ ChangeLog	2013-04-10 13:45:34 +0000
@@ -59,6 +59,8 @@
   * Fixed bug #1076402 (bug in CastIterator when target is QName)
   * NaN items are considered equal to each other during grouping
   * Fixed bug #855481 (Too small time types on Windows).
+  * Fixed bug #1154984 (windows build crashes if a vector iterator is reused
+    after it is used to erase an element of the vector)
   * Fixed bug #1132032 (Certain regexes involving ^ should be legal)
   * Fixed bug #1023168 (Non-single-char-escapes in regex character ranges not
     caught)

=== modified file 'src/compiler/expression/flwor_expr.h'
--- src/compiler/expression/flwor_expr.h	2013-02-21 16:34:45 +0000
+++ src/compiler/expression/flwor_expr.h	2013-04-10 13:45:34 +0000
@@ -442,7 +442,10 @@
 
   void set_nongrouping_ars(rebind_list_t& v) { theNonGroupVars = v; }
 
-  void removeNonGroupingVar(rebind_list_t::iterator ite) { theNonGroupVars.erase(ite); }
+  rebind_list_t::iterator removeNonGroupingVar(rebind_list_t::iterator& ite)
+  {
+    return theNonGroupVars.erase(ite);
+  }
 
   rebind_list_t::iterator beginGroupVars() { return theGroupVars.begin(); }
 

=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
--- src/compiler/rewriter/rules/flwor_rules.cpp	2013-04-08 11:38:48 +0000
+++ src/compiler/rewriter/rules/flwor_rules.cpp	2013-04-10 13:45:34 +0000
@@ -248,17 +248,20 @@
       flwor_clause::rebind_list_t::iterator ite = gc->beginNonGroupVars();
       flwor_clause::rebind_list_t::iterator end = gc->endNonGroupVars();
 
-      for(; ite != end; ++ite)
+      while(ite != end)
       {
         var_expr* var = ite->second;
         int uses = expr_tools::count_variable_uses(theFlwor, var, 1, NULL);
 
         if (uses == 0 && !ite->first->isNonDiscardable())
         {
-          gc->removeNonGroupingVar(ite);
-          --ite;
+          ite = gc->removeNonGroupingVar(ite);
           end = gc->endNonGroupVars();
         }
+        else
+        {
+          ++ite;
+        }
       }
 
       break;


Follow ups