Browse Source

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
patch-4
SomberNight 3 years ago
parent
commit
57ec9612cb
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/gui/qt/confirm_tx_dialog.py
  2. 11
      electrum/gui/qt/util.py

1
electrum/gui/qt/confirm_tx_dialog.py

@ -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):

11
electrum/gui/qt/util.py

@ -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):

Loading…
Cancel
Save