From 970f84151d265f2823c0520211d076e181062139 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 18 Jul 2025 15:51:27 +0000 Subject: [PATCH] crash reporter: remove "Never" btn and config.SHOW_CRASH_REPORTER opt - always hook into sys.excepthook and show the crash reporter - if we don't hook into sys.excepthook and an exception propagates out on a Qt thread, that kills the Qt GUI - ref https://github.com/spesmilo/electrum/pull/10049#issuecomment-3089278083 --- electrum/gui/qml/components/ExceptionDialog.qml | 9 --------- electrum/gui/qml/qeapp.py | 7 ------- electrum/gui/qt/exception_window.py | 11 ----------- electrum/simple_config.py | 1 - 4 files changed, 28 deletions(-) diff --git a/electrum/gui/qml/components/ExceptionDialog.qml b/electrum/gui/qml/components/ExceptionDialog.qml index eb162a01c..e4159232a 100644 --- a/electrum/gui/qml/components/ExceptionDialog.qml +++ b/electrum/gui/qml/components/ExceptionDialog.qml @@ -89,15 +89,6 @@ ElDialog dialog.open() } } - Button { - Layout.fillWidth: true - Layout.preferredWidth: 2 - text: qsTr('Never') - onClicked: { - AppController.showNever() - close() - } - } Button { Layout.fillWidth: true Layout.preferredWidth: 2 diff --git a/electrum/gui/qml/qeapp.py b/electrum/gui/qml/qeapp.py index 38de0c407..0b8de14ad 100644 --- a/electrum/gui/qml/qeapp.py +++ b/electrum/gui/qml/qeapp.py @@ -379,10 +379,6 @@ class QEAppController(BaseCrashReporter, QObject): self.sendingBugreport.emit() threading.Thread(target=report_task, daemon=True).start() - @pyqtSlot() - def showNever(self): - self.config.SHOW_CRASH_REPORTER = False - def _get_traceback_str_to_display(self) -> str: # The msg_box that shows the report uses rich_text=True, so # if traceback contains special HTML characters, e.g. '<', @@ -551,9 +547,6 @@ class Exception_Hook(QObject, Logger): @classmethod def maybe_setup(cls, *, wallet: 'Abstract_Wallet' = None, slot=None) -> None: - if not QEConfig.instance.config.SHOW_CRASH_REPORTER: - EarlyExceptionsQueue.set_hook_as_ready() # flush already queued exceptions - return if not cls._INSTANCE: cls._INSTANCE = Exception_Hook(slot=slot) if wallet: diff --git a/electrum/gui/qt/exception_window.py b/electrum/gui/qt/exception_window.py index 9e5a2e8d2..63aa1cec1 100644 --- a/electrum/gui/qt/exception_window.py +++ b/electrum/gui/qt/exception_window.py @@ -87,10 +87,6 @@ class Exception_Window(BaseCrashReporter, QWidget, MessageBoxMixin, Logger): report_button.setIcon(read_QIcon("tab_send.png")) buttons.addWidget(report_button) - never_button = QPushButton(_('Never')) - never_button.clicked.connect(lambda _checked: self.show_never()) - buttons.addWidget(never_button) - close_button = QPushButton(_('Not Now')) close_button.clicked.connect(lambda _checked: self.close()) buttons.addWidget(close_button) @@ -137,10 +133,6 @@ class Exception_Window(BaseCrashReporter, QWidget, MessageBoxMixin, Logger): Exception_Window._active_window = None self.close() - def show_never(self): - self.config.SHOW_CRASH_REPORTER = False - self.close() - def closeEvent(self, event): self.on_close() event.accept() @@ -192,9 +184,6 @@ class Exception_Hook(QObject, Logger): @classmethod def maybe_setup(cls, *, config: 'SimpleConfig', wallet: 'Abstract_Wallet' = None) -> None: - if not config.SHOW_CRASH_REPORTER: - EarlyExceptionsQueue.set_hook_as_ready() # flush already queued exceptions - return if not cls._INSTANCE: cls._INSTANCE = Exception_Hook(config=config) if wallet: diff --git a/electrum/simple_config.py b/electrum/simple_config.py index fc8312a8c..7e096964c 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -886,7 +886,6 @@ Warning: setting this to too low will result in lots of payment failures."""), long_desc=lambda: _("Select which language is used in the GUI (after restart)."), ) BLOCKCHAIN_PREFERRED_BLOCK = ConfigVar('blockchain_preferred_block', default=None) - SHOW_CRASH_REPORTER = ConfigVar('show_crash_reporter', default=True, type_=bool) DONT_SHOW_TESTNET_WARNING = ConfigVar('dont_show_testnet_warning', default=False, type_=bool) RECENTLY_OPEN_WALLET_FILES = ConfigVar('recently_open', default=None) IO_DIRECTORY = ConfigVar('io_dir', default=os.path.expanduser('~'), type_=str)