Set the next stack before adding the user container

Since the user container may trigger a propertyChanged signal, which then requests the next stack.

Contributes to issue CURA-4121.
This commit is contained in:
Ghostkeeper 2017-08-07 09:45:16 +02:00
parent b4be6fcb9f
commit 584e1b6abb
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75

View File

@ -76,6 +76,8 @@ class CuraStackBuilder:
stack.setName(definition.getName())
stack.setDefinition(definition)
stack.addMetaDataEntry("position", definition.getMetaDataEntry("position"))
if "next_stack" in kwargs: #Add stacks before containers are added, since they may trigger a setting update.
stack.setNextStack(kwargs["next_stack"])
user_container = InstanceContainer(new_stack_id + "_user")
user_container.addMetaDataEntry("type", "user")
@ -86,9 +88,6 @@ class CuraStackBuilder:
stack.setUserChanges(user_container)
if "next_stack" in kwargs:
stack.setNextStack(kwargs["next_stack"])
# Important! The order here matters, because that allows the stack to
# assume the material and variant have already been set.
if "definition_changes" in kwargs: