Skip to content

Commit 1559129

Browse files
committed
qml: properly destroy ExceptionDialog after close, improve encapsulation
1 parent 1d07895 commit 1559129

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

electrum/gui/qml/components/ExceptionDialog.qml

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ElDialog
1717

1818
width: parent.width
1919
height: parent.height
20+
z: 1000 // assure topmost of all other dialogs
2021

2122
header: null
2223

@@ -61,12 +62,12 @@ ElDialog
6162
text: qsTr('Please briefly describe what led to the error (optional):')
6263
}
6364
TextArea {
65+
id: user_text
6466
Layout.fillWidth: true
6567
Layout.fillHeight: true
6668
background: Rectangle {
6769
color: Qt.darker(Material.background, 1.25)
6870
}
69-
onTextChanged: AppController.setCrashUserText(text)
7071
}
7172
Label {
7273
text: qsTr('Do you want to send this report?')
@@ -76,7 +77,7 @@ ElDialog
7677
Layout.fillWidth: true
7778
Layout.preferredWidth: 3
7879
text: qsTr('Send Bug Report')
79-
onClicked: AppController.sendReport()
80+
onClicked: AppController.sendReport(user_text.text)
8081
}
8182
Button {
8283
Layout.fillWidth: true
@@ -106,10 +107,9 @@ ElDialog
106107
ElDialog {
107108
property string reportText
108109

109-
z: 3000
110-
111110
width: parent.width
112111
height: parent.height
112+
z: 1001 // above root
113113

114114
header: null
115115

@@ -125,6 +125,7 @@ ElDialog
125125
width: parent.width
126126
}
127127
}
128+
onClosed: destroy()
128129
}
129130
}
130131

electrum/gui/qml/components/main.qml

+7-7
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,13 @@ ApplicationWindow
423423
}
424424
}
425425

426+
Component {
427+
id: crashDialog
428+
ExceptionDialog {
429+
onClosed: destroy()
430+
}
431+
}
432+
426433
property alias channelOpenProgressDialog: _channelOpenProgressDialog
427434
ChannelOpenProgressDialog {
428435
id: _channelOpenProgressDialog
@@ -486,13 +493,6 @@ ApplicationWindow
486493
width: parent.width
487494
}
488495

489-
Component {
490-
id: crashDialog
491-
ExceptionDialog {
492-
z: 1000
493-
}
494-
}
495-
496496
Component.onCompleted: {
497497
coverTimer.start()
498498

electrum/gui/qml/qeapp.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,14 @@ def crash(self, config, e, text, tb):
303303
self.exc_args = (e, text, tb) # for BaseCrashReporter
304304
self.showException.emit(self.crashData())
305305

306-
@pyqtSlot()
307-
def sendReport(self):
306+
@pyqtSlot(str)
307+
def sendReport(self, user_text: str):
308+
self._crash_user_text = user_text
308309
network = Network.get_instance()
309310
proxy = network.proxy
310311

311312
def report_task():
313+
self.logger.debug('starting report_task')
312314
try:
313315
response = BaseCrashReporter.send_report(self, network.asyncio_loop, proxy)
314316
except Exception as e:
@@ -330,10 +332,6 @@ def report_task():
330332
def showNever(self):
331333
self.config.SHOW_CRASH_REPORTER = False
332334

333-
@pyqtSlot(str)
334-
def setCrashUserText(self, text):
335-
self._crash_user_text = text
336-
337335
def _get_traceback_str_to_display(self) -> str:
338336
# The msg_box that shows the report uses rich_text=True, so
339337
# if traceback contains special HTML characters, e.g. '<',

0 commit comments

Comments
 (0)