Browse Source

Prevent crash when starting the firmware update twice

CURA-6Q
Jaime van Kessel 4 years ago
parent
commit
1a04744679
1 changed files with 6 additions and 2 deletions
  1. 6 2
      cura/PrinterOutput/FirmwareUpdater.py

+ 6 - 2
cura/PrinterOutput/FirmwareUpdater.py

@@ -7,6 +7,8 @@ from enum import IntEnum
 from threading import Thread
 from typing import Union
 
+from UM.Logger import Logger
+
 MYPY = False
 if MYPY:
     from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice
@@ -38,8 +40,10 @@ class FirmwareUpdater(QObject):
             return
 
         self._setFirmwareUpdateState(FirmwareUpdateState.updating)
-
-        self._update_firmware_thread.start()
+        try:
+            self._update_firmware_thread.start()
+        except RuntimeError:
+            Logger.warning("Could not start the update thread, since it's still running!")
 
     def _updateFirmware(self) -> None:
         raise NotImplementedError("_updateFirmware needs to be implemented")