From 57ec9612cb3395bfc1237c56efb3c3fdb144145f Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 20 May 2022 18:05:16 +0200 Subject: [PATCH] Qt ConfirmTxDialog: make sure dialog is deleted when closed Same for BlockingWaitingDialog. related: https://github.com/spesmilo/electrum/issues/3956#issuecomment-1017593613 Note that this change does not solve the "dialog sometimes does not get drawn properly" issue, just the "dialog sometimes does not get closed properly" issue. closes: https://github.com/spesmilo/electrum/issues/7816 --- electrum/gui/qt/confirm_tx_dialog.py | 1 + electrum/gui/qt/util.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/confirm_tx_dialog.py b/electrum/gui/qt/confirm_tx_dialog.py index 18d4469ca..21ee9927b 100644 --- a/electrum/gui/qt/confirm_tx_dialog.py +++ b/electrum/gui/qt/confirm_tx_dialog.py @@ -193,6 +193,7 @@ class ConfirmTxDialog(TxEditor, WindowModalDialog): def run(self): cancelled = not self.exec_() password = self.pw.text() or None + self.deleteLater() # see #3956 return cancelled, self.is_send, password, self.tx def on_send(self): diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py index b605432b9..d35acbfe8 100644 --- a/electrum/gui/qt/util.py +++ b/electrum/gui/qt/util.py @@ -337,15 +337,18 @@ class BlockingWaitingDialog(WindowModalDialog): self.message_label = QLabel(message) vbox = QVBoxLayout(self) vbox.addWidget(self.message_label) + self.finished.connect(self.deleteLater) # see #3956 # show popup self.show() # refresh GUI; needed for popup to appear and for message_label to get drawn QCoreApplication.processEvents() QCoreApplication.processEvents() - # block and run given task - task() - # close popup - self.accept() + try: + # block and run given task + task() + finally: + # close popup + self.accept() def line_dialog(parent, title, label, ok_label, default=None):