Browse Source

Prevent max recursion for convex hull calculation

fixes CURA-3W
Jaime van Kessel 5 years ago
parent
commit
27c6cb4c1e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      cura/Scene/ConvexHullDecorator.py

+ 8 - 1
cura/Scene/ConvexHullDecorator.py

@@ -36,8 +36,10 @@ class ConvexHullDecorator(SceneNodeDecorator):
 
         # Make sure the timer is created on the main thread
         self._recompute_convex_hull_timer = None  # type: Optional[QTimer]
+        self._timer_scheduled_to_be_created = False
         from cura.CuraApplication import CuraApplication
         if CuraApplication.getInstance() is not None:
+            self._timer_scheduled_to_be_created = True
             CuraApplication.getInstance().callLater(self.createRecomputeConvexHullTimer)
 
         self._raft_thickness = 0.0
@@ -171,7 +173,12 @@ class ConvexHullDecorator(SceneNodeDecorator):
         if self._recompute_convex_hull_timer is not None:
             self._recompute_convex_hull_timer.start()
         else:
-            self.recomputeConvexHull()
+            from cura.CuraApplication import CuraApplication
+            if not self._timer_scheduled_to_be_created:
+                # The timer is not created and we never scheduled it. Time to create it now!
+                CuraApplication.getInstance().callLater(self.createRecomputeConvexHullTimer)
+            # Now we know for sure that the timer has been scheduled for creation, so we can try this again.
+            CuraApplication.getInstance().callLater(self.recomputeConvexHullDelayed)
 
     def recomputeConvexHull(self) -> None:
         controller = Application.getInstance().getController()