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
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user