mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-28 23:04:34 +08:00
Prevent duplicate adding of extruders
The addMachineExtruders function assumes that this is a new printer (first time the printer is activated since a restart of Cura) and it needs to add the extruder stacks to it. However most of the time when we're switching, it's not to a new printer. If it's not a new printer, this function would get called anyway and we'd be adding the extruders multiple times. This then does a lot of unnecessary work and eventually fails a couple of calls deep. This change prevents it from adding the extruders if there are already extruders associated with the printer, thus preventing this unnecessary work (switch is faster) and preventing the error from happening. Discovered during work on CURA-7501.
This commit is contained in:
parent
5668eba6b2
commit
4b3fda21e2
@ -336,7 +336,8 @@ class MachineManager(QObject):
|
||||
return # We're done here
|
||||
|
||||
self._global_container_stack = global_stack
|
||||
extruder_manager.addMachineExtruders(global_stack)
|
||||
if not global_stack.extruderList: # First time we're activating this, there are no extruders yet.
|
||||
extruder_manager.addMachineExtruders(global_stack)
|
||||
self._application.setGlobalContainerStack(global_stack)
|
||||
|
||||
# Switch to the first enabled extruder
|
||||
|
Loading…
x
Reference in New Issue
Block a user