What changed, and why it matters
This commit fixes a bug in Electrum's Qt send tab where the app could crash if a user edited the payment recipient field quickly while previous lookups were still finishing. The fix ignores results from outdated lookups instead of letting them trigger an error.
Apply the patch. It is a low-risk defensive fix that prevents UI crashes. No immediate security response is needed beyond normal update cadence.
Security signals we found
Fixes a race condition between asynchronous resolve callbacks and UI state
Prevents exception/crash from stale callback accessing invalid state
Issue reference suggests reproducible crash via timing manipulation
Evidence from the diff
The patch adds a guard in on_resolve_done() in electrum/gui/qt/send_tab.py that checks whether the resolved PaymentIdentifier (pi) still matches the current value of self.payto_e.payment_identifier. If it does not, the callback returns early, preventing a stale resolve result from being processed after the user has already changed or cleared the field. This avoids an exception caused by accessing a cleared or replaced PI.
Changed components
electrum/gui/qt/send_tab.pyPaymentIdentifier resolution flow in Qt send tabInspect captured patch +4 / −0
diff --git a/electrum/gui/qt/send_tab.py b/electrum/gui/qt/send_tab.py
index 6da1c54..91d4e72 100644
--- a/electrum/gui/qt/send_tab.py
+++ b/electrum/gui/qt/send_tab.py
@@ -493,6 +493,10 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
def on_resolve_done(self, pi: 'PaymentIdentifier'):
# TODO: resolve can happen while typing, we don't want message dialogs to pop up
# currently we don't set error for emaillike recipients to avoid just that
+ if pi != self.payto_e.payment_identifier:
+ self.logger.debug(f"stale resolve done")
+ return
+
self.logger.debug('payment identifier resolve done')
self.spinner.setVisible(False)
if pi.error:
Why this scored 24/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.