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):
|
def run(self):
|
||||||
cancelled = not self.exec_()
|
cancelled = not self.exec_()
|
||||||
password = self.pw.text() or None
|
password = self.pw.text() or None
|
||||||
|
self.deleteLater() # see #3956
|
||||||
return cancelled, self.is_send, password, self.tx
|
return cancelled, self.is_send, password, self.tx
|
||||||
|
|
||||||
def on_send(self):
|
def on_send(self):
|
||||||
|
|||||||
@@ -337,15 +337,18 @@ class BlockingWaitingDialog(WindowModalDialog):
|
|||||||
self.message_label = QLabel(message)
|
self.message_label = QLabel(message)
|
||||||
vbox = QVBoxLayout(self)
|
vbox = QVBoxLayout(self)
|
||||||
vbox.addWidget(self.message_label)
|
vbox.addWidget(self.message_label)
|
||||||
|
self.finished.connect(self.deleteLater) # see #3956
|
||||||
# show popup
|
# show popup
|
||||||
self.show()
|
self.show()
|
||||||
# refresh GUI; needed for popup to appear and for message_label to get drawn
|
# refresh GUI; needed for popup to appear and for message_label to get drawn
|
||||||
QCoreApplication.processEvents()
|
QCoreApplication.processEvents()
|
||||||
QCoreApplication.processEvents()
|
QCoreApplication.processEvents()
|
||||||
# block and run given task
|
try:
|
||||||
task()
|
# block and run given task
|
||||||
# close popup
|
task()
|
||||||
self.accept()
|
finally:
|
||||||
|
# close popup
|
||||||
|
self.accept()
|
||||||
|
|
||||||
|
|
||||||
def line_dialog(parent, title, label, ok_label, default=None):
|
def line_dialog(parent, title, label, ok_label, default=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user