Make layer processing abort when starting slice

This involved adding an abort flag to the layer processing job, and making the job check back on that flag periodically. If processing a single layer takes forever then it will never stop the job at all, so it assumes that the concurrent programming in Python is Fair.

Contributes to issue CURA-864.
This commit is contained in:
Ghostkeeper 2016-02-19 12:25:08 +01:00
parent c0d167e751
commit 63a8b96049
2 changed files with 35 additions and 3 deletions

View file

@ -73,6 +73,7 @@ class CuraEngineBackend(Backend):
self._restart = False
self._enabled = True
self._always_restart = True
self._process_layers_job = None #The currently active job to process layers, or None if it is not processing layers.
self._message = None
@ -120,6 +121,10 @@ class CuraEngineBackend(Backend):
self.slicingCancelled.emit()
return
if self._process_layers_job:
self._process_layers_job.abort()
self._process_layers_job = None
if self._profile.hasErrorValue():
Logger.log("w", "Profile has error values. Aborting slicing")
if self._message:
@ -193,8 +198,8 @@ class CuraEngineBackend(Backend):
def _onSlicedObjectListMessage(self, message):
if self._layer_view_active:
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
job.start()
self._process_layers_job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
self._process_layers_job.start()
else :
self._stored_layer_data = message