Salome HOME
Fix valgrind error: Mismatched free() / delete / delete []
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_GetInPlace_3.cxx
index 4b8388ffbd6063cb77571f8416e0ef6ad6ae7f44..9726a4f3b3ee72c791ca942452ae5f586c8acced 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -75,6 +75,16 @@ void GEOMAlgo_GetInPlaceIterator::AppendPair(const GEOMAlgo_CoupleOfShapes& theC
   iX=TypeToInteger(aType1, aType2);
   if (iX>=0) {
     myLists[iX].Append(theCS);
+  } else {
+    // Add inverted pair of shapes.
+    iX=TypeToInteger(aType2, aType1);
+
+    if (iX>=0) {
+      GEOMAlgo_CoupleOfShapes aCSInv;
+
+      aCSInv.SetShapes(aS2, aS1);
+      myLists[iX].Append(aCSInv);
+    }
   }
 }
 //=======================================================================