bug fix
authorbdemsky <bdemsky@uci.edu>
Thu, 2 Aug 2018 19:47:43 +0000 (12:47 -0700)
committerbdemsky <bdemsky@uci.edu>
Thu, 2 Aug 2018 19:47:43 +0000 (12:47 -0700)
src/csolver.cc

index b42dbe0974224df3560d5f95b96aed1e5fce56f2..58177a55647a3fe0f7f344955ccfbacf3efe2757 100644 (file)
@@ -520,8 +520,14 @@ void CSolver::addConstraint(BooleanEdge constraint) {
                        BooleanLogic *b = (BooleanLogic *) constraint.getBoolean();
                        if (!constraint.isNegated()) {
                                if (b->op == SATC_AND) {
                        BooleanLogic *b = (BooleanLogic *) constraint.getBoolean();
                        if (!constraint.isNegated()) {
                                if (b->op == SATC_AND) {
-                                       for (uint i = 0; i < b->inputs.getSize(); i++) {
-                                               addConstraint(b->inputs.get(i));
+                                       uint size = b->inputs.getSize();
+                                       //Handle potential concurrent modification
+                                       BooleanEdge array[size];
+                                       for (uint i = 0; i < size; i++) {
+                                               array[i] = b->inputs.get(i);
+                                       }
+                                       for (uint i = 0; i < size; i++) {
+                                               addConstraint(array[i]);
                                        }
                                        return;
                                }
                                        }
                                        return;
                                }