Workaround for deadlock in face/hole merge function in carve
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 5 Feb 2013 14:27:24 +0000 (14:27 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 5 Feb 2013 14:27:24 +0000 (14:27 +0000)
which could happen in cases of degenerated faces.

extern/carve/lib/intersect_face_division.cpp

index c74b52d..c5d5d8c 100644 (file)
@@ -719,6 +719,10 @@ namespace {
           unassigned--;
         }
       }
+
+      if (!removed.size())
+        throw carve::exception("Failed to merge holes");
+
       for (std::set<int>::iterator f = removed.begin(); f != removed.end(); ++f) {
         for (unsigned i = 0; i < containing_faces.size(); ++i) {
           containing_faces[i].erase(std::remove(containing_faces[i].begin(),