Add documentation and further specify except around disconnecting signals

Catch just a TypeError instead of all exceptions. Added documentation to say why we catch a TypeError there. Also splitted up the try-except block for the 3 disconnects, just so that if the first fails we still try to disconnect from the other two.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-05-03 14:56:52 +02:00
parent d95488a940
commit 86f1a0559f
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
2 changed files with 8 additions and 2 deletions

View file

@ -236,9 +236,15 @@ class MachineManager(QObject):
if self._global_container_stack:
try:
self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged)
except TypeError: #pyQtSignal gives a TypeError when disconnecting from something that was already disconnected.
pass
try:
self._global_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged)
except TypeError:
pass
try:
self._global_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
except:
except TypeError:
pass
material = self._global_container_stack.material
material.nameChanged.disconnect(self._onMaterialNameChanged)