From 577365cf968a78767a8b45f843f924e8e221191a Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 15 Oct 2019 08:19:32 +0200 Subject: [PATCH] Fx containerAdded handling in VariantNode CURA-6889 --- cura/Machines/VariantNode.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cura/Machines/VariantNode.py b/cura/Machines/VariantNode.py index 27e359afb1..efe15dbec2 100644 --- a/cura/Machines/VariantNode.py +++ b/cura/Machines/VariantNode.py @@ -101,6 +101,14 @@ class VariantNode(ContainerNode): def _materialAdded(self, container: ContainerInterface) -> None: if container.getMetaDataEntry("type") != "material": return # Not interested. + if not ContainerRegistry.getInstance().findContainersMetadata(id = container.getId()): + # CURA-6889 + # containerAdded and removed signals may be triggered in the next event cycle. If a container gets added + # and removed in the same event cycle, in the next cycle, the connections should just ignore the signals. + # The check here makes sure that the container in the signal still exists. + Logger.log("d", "Got container added signal for container [%s] but it no longer exists, do nothing.", + container.getId()) + return if not self.machine.has_materials: return # We won't add any materials. material_definition = container.getMetaDataEntry("definition")