Added exception handling for when wrapped reply object is already deleted

CURA-2295
This commit is contained in:
Jaime van Kessel 2016-09-07 11:56:19 +02:00
parent f2e93bfd97
commit 93cc25b408

View file

@ -252,6 +252,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._connection_message.show()
# Check if we were uploading something. Abort if this is the case.
# Some operating systems handle this themselves, others give weird issues.
try:
if self._post_reply:
self._post_reply.abort()
try:
@ -259,6 +260,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
except TypeError:
pass # The disconnection can fail on mac in some cases. Ignore that.
self._progress_message.hide()
except RuntimeError:
self._post_reply = None # It can happen that the wrapped c++ object is already deleted.
return
else:
self._recreate_network_manager_count = 1
@ -273,6 +276,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._connection_message.show()
# Check if we were uploading something. Abort if this is the case.
# Some operating systems handle this themselves, others give weird issues.
try:
if self._post_reply:
self._post_reply.abort()
try:
@ -280,6 +284,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
except TypeError:
pass # The disconnection can fail on mac in some cases. Ignore that.
self._progress_message.hide()
except RuntimeError:
self._post_reply = None # It can happen that the wrapped c++ object is already deleted.
self.setConnectionState(ConnectionState.error)
return