qml: use daemon threads everywhere the network is involved
The app hangs indefinitely if we try to quit it while one of
these threads is active, because once asyncio has shut down,
futures never return. This was already fixed for lightning
payments in c5dc133, but there are many other cases.
This commit is contained in:
@@ -265,7 +265,7 @@ class QEAppController(BaseCrashReporter, QObject):
|
||||
self.sendingBugreportSuccess.emit(text)
|
||||
|
||||
self.sendingBugreport.emit()
|
||||
threading.Thread(target=report_task).start()
|
||||
threading.Thread(target=report_task, daemon=True).start()
|
||||
|
||||
@pyqtSlot()
|
||||
def showNever(self):
|
||||
|
||||
@@ -194,7 +194,7 @@ class QEChannelDetails(QObject, QtEventListener):
|
||||
self._logger.exception("Could not close channel: " + repr(e))
|
||||
self.channelCloseFailed.emit(_('Could not close channel: ') + repr(e))
|
||||
|
||||
threading.Thread(target=do_close).start()
|
||||
threading.Thread(target=do_close, daemon=True).start()
|
||||
|
||||
@pyqtSlot()
|
||||
def deleteChannel(self):
|
||||
|
||||
@@ -216,7 +216,7 @@ class QEChannelOpener(QObject, AuthMixin):
|
||||
|
||||
self._logger.debug('starting open thread')
|
||||
self.channelOpening.emit(conn_str)
|
||||
threading.Thread(target=open_thread).start()
|
||||
threading.Thread(target=open_thread, daemon=True).start()
|
||||
|
||||
# TODO: it would be nice to show this before broadcasting
|
||||
#if chan.has_onchain_backup():
|
||||
|
||||
@@ -587,7 +587,7 @@ class QEInvoiceParser(QEInvoice):
|
||||
except Exception as e:
|
||||
self.validationError.emit('lnurl', repr(e))
|
||||
|
||||
threading.Thread(target=resolve_task).start()
|
||||
threading.Thread(target=resolve_task, daemon=True).start()
|
||||
|
||||
def on_lnurl(self, lnurldata):
|
||||
self._logger.debug('on_lnurl')
|
||||
@@ -635,7 +635,7 @@ class QEInvoiceParser(QEInvoice):
|
||||
self._logger.error(repr(e))
|
||||
self.lnurlError.emit('lnurl', str(e))
|
||||
|
||||
threading.Thread(target=fetch_invoice_task).start()
|
||||
threading.Thread(target=fetch_invoice_task, daemon=True).start()
|
||||
|
||||
def on_lnurl_invoice(self, orig_amount, invoice):
|
||||
self._logger.debug('on_lnurl_invoice')
|
||||
|
||||
@@ -350,7 +350,7 @@ class QESwapHelper(AuthMixin, QObject):
|
||||
self._logger.error(str(e))
|
||||
self.swapFailed.emit(str(e))
|
||||
|
||||
threading.Thread(target=swap_task).start()
|
||||
threading.Thread(target=swap_task, daemon=True).start()
|
||||
|
||||
def do_reverse_swap(self, lightning_amount, onchain_amount):
|
||||
if lightning_amount is None or onchain_amount is None:
|
||||
@@ -375,7 +375,7 @@ class QESwapHelper(AuthMixin, QObject):
|
||||
self._logger.error(str(e))
|
||||
self.swapFailed.emit(str(e))
|
||||
|
||||
threading.Thread(target=swap_task).start()
|
||||
threading.Thread(target=swap_task, daemon=True).start(d)
|
||||
|
||||
@pyqtSlot()
|
||||
@pyqtSlot(bool)
|
||||
|
||||
Reference in New Issue
Block a user