From 6fc62fd2b3ce3a81edc70ccf86a6a5a616453854 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 2 Oct 2017 17:34:49 +0200 Subject: [PATCH] Don't try to disconnect after aborting Because if the signal is not connected then we'd get a segfault in this case. Contributes to issue CURA-4376. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index f23986f7f0..9377fba6b9 100755 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -331,13 +331,14 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if self._camera_timer.isActive(): self._camera_timer.stop() - else: #Camera wasn't even running. Don't try to stop it or you'll get a segfault. - return if self._image_reply: try: + try: + self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) + except TypeError: + pass #The signal was never connected. self._image_reply.abort() - self._image_reply.downloadProgress.disconnect(self._onStreamDownloadProgress) except RuntimeError: pass # It can happen that the wrapped c++ object is already deleted. self._image_reply = None