From bc50f0fa7cdb5ef04cefb7790ac4a249ad5f69b4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 28 Jun 2016 15:00:35 +0200 Subject: [PATCH] Only close connection if it's open when re-checking connections --- NetworkPrinterOutputDevicePlugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NetworkPrinterOutputDevicePlugin.py b/NetworkPrinterOutputDevicePlugin.py index cee9e5654c..4055b59a1a 100644 --- a/NetworkPrinterOutputDevicePlugin.py +++ b/NetworkPrinterOutputDevicePlugin.py @@ -44,7 +44,8 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): self._printers[key].connect() self._printers[key].connectionStateChanged.connect(self._onPrinterConnectionStateChanged) else: - self._printers[key].close() + if self._printers[key].isConnected(): + self._printers[key].close() ## Because the model needs to be created in the same thread as the QMLEngine, we use a signal. def addPrinter(self, name, address, properties):