Merge pull request #11172 from accumulator/qml_crash_reporter_threading
What changed, and why it matters
This is a small bug-fix patch for Electrum's QML (mobile-style) graphical interface. The crash reporter was not correctly handling exceptions that come from Python's threading system, which could cause the crash reporter itself to misbehave or fail to report a crash. There is no indication this allows an attacker to take control, steal funds, or bypass security; it is a reliability fix in error-handling code.
Treat as a routine bug-fix merge. No urgent security action is required. If auditing, verify that no other exception handlers in the QML GUI make the same assumption about exc_info shape.
Security signals we found
Fixes incorrect exception argument handling in crash reporter
Prevents potential secondary failure in error-reporting path
No security boundary crossed; no input from untrusted source is processed
Evidence from the diff
The change modifies electrum/gui/qml/qeapp.py’s crash reporter handler. Python’s threading.excepthook passes a single threading.ExceptHookArgs object, while sys.excepthook passes the traditional (exc_type, exc_value, exc_traceback) tuple. The previous handler assumed the latter and would unpack incorrectly for thread exceptions. The patch detects the single-argument form, extracts the exception fields, and logs the exception value repr. This prevents the crash reporter from raising a secondary error or producing malformed data when a background thread crashes.
Changed components
electrum/gui/qml/qeapp.pyQML crash reporter exception handlerInspect captured patch +4 / −1
### electrum/gui/qml/qeapp.py
@@ -654,7 +654,10 @@ def maybe_setup(cls, *, wallet: 'Abstract_Wallet' = None, slot=None) -> None:
cls._INSTANCE.wallet_types_seen.add(wallet.wallet_type)
def handler(self, *exc_info):
- self.logger.error('exception caught by crash reporter', exc_info=exc_info)
+ if len(exc_info) == 1: # threading.excepthook passes a single ExceptHookArgs
+ args = exc_info[0]
+ exc_info = (args.exc_type, args.exc_value, args.exc_traceback)
+ self.logger.error(f'exception caught by crash reporter {repr(exc_info[1])}', exc_info=exc_info)
groupid_hash = BaseCrashReporter.get_traceback_groupid_hash(*exc_info)
if groupid_hash in self.exception_ids_seen:
return # to avoid annoying the user, only show crash reporter once per exception groupidWhy this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.