Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2019-08-26 10:15:37 +0300
committerGhostkeeper <rubend@tutanota.com>2019-08-26 10:15:37 +0300
commit23f4aa6e4f6d02b0342fb727cbed2991f3ea16d1 (patch)
treefe4469a8f208260babaf2af3bcb15541f9c3d2aa /plugins/CuraEngineBackend
parent8d8f18d9535201543b6031903f73cc4e7b2bbec3 (diff)
Fix potential race condition when slice messages arrive after clearing build plate
Fixes #6245.
Diffstat (limited to 'plugins/CuraEngineBackend')
-rwxr-xr-xplugins/CuraEngineBackend/CuraEngineBackend.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py
index ae18e76e5a..2aae1fff21 100755
--- a/plugins/CuraEngineBackend/CuraEngineBackend.py
+++ b/plugins/CuraEngineBackend/CuraEngineBackend.py
@@ -671,14 +671,20 @@ class CuraEngineBackend(QObject, Backend):
#
# \param message The protobuf message containing g-code, encoded as UTF-8.
def _onGCodeLayerMessage(self, message: Arcus.PythonMessage) -> None:
- self._scene.gcode_dict[self._start_slice_job_build_plate].append(message.data.decode("utf-8", "replace")) #type: ignore #Because we generate this attribute dynamically.
+ try:
+ self._scene.gcode_dict[self._start_slice_job_build_plate].append(message.data.decode("utf-8", "replace")) #type: ignore #Because we generate this attribute dynamically.
+ except KeyError: # Can occur if the g-code has been cleared while a slice message is still arriving from the other end.
+ pass # Throw the message away.
## Called when a g-code prefix message is received from the engine.
#
# \param message The protobuf message containing the g-code prefix,
# encoded as UTF-8.
def _onGCodePrefixMessage(self, message: Arcus.PythonMessage) -> None:
- self._scene.gcode_dict[self._start_slice_job_build_plate].insert(0, message.data.decode("utf-8", "replace")) #type: ignore #Because we generate this attribute dynamically.
+ try:
+ self._scene.gcode_dict[self._start_slice_job_build_plate].insert(0, message.data.decode("utf-8", "replace")) #type: ignore #Because we generate this attribute dynamically.
+ except KeyError: # Can occur if the g-code has been cleared while a slice message is still arriving from the other end.
+ pass # Throw the message away.
## Creates a new socket connection.
def _createSocket(self, protocol_file: str = None) -> None: