Skip to content

Review finding: the PSBT dialog can be closed while it is signing #325

Closed

Description

@kiwidream

Summary

The PSBT dialog can be closed while signing, which blocks the GUI thread for the rest of the signing and silently discards the signed PSBT and its usage report.

Severity: low. Found in the 2026-11-04 review of the v1.0.1 change set (all 1.x.x merges since v1.0.0 plus the open PRs that target it), against 1.x.x 21fee6ee8e; area: #145.

Observed

Confidence: plausible (reasoned; narrow timing for the P2MR case).

  • Location: src/qt/psbtoperationsdialog.cpp:87 (Close is never disabled; setSigningControlsEnabled(false) at :377-387 disables only copy/save/sign/broadcast), :93-104 (destructor joins the worker), :346-364 (the non-reserved Cancel branch does not re-show the progress dialog). There is no reject()/closeEvent() override in psbtoperationsdialog.h.

  • Scenario: The application-modal progress dialog appears only after 250 ms (:176-180). Qt's default canceled()→cancel() connection hides it on Cancel, and only the counters-reserved branch calls show() again (:354). So the PSBT dialog accepts Close, Esc or the window-manager close in two cases:

    • During the first 250 ms after Sign. By then provider collection and the first counter reservation are usually done.
    • After Cancel, when the worker raced past the pre-reservation check (wallet.cpp:2962) into SignPSBTInput. Cancel is not atomic with the reservation, unlike the fee-bump CAS. For an external-signer wallet, Cancel is accepted during the device interaction because no counters are involved.

    Closing deletes the dialog (WA_DeleteOnClose via ShowModalDialogAsynchronously). ~PSBTOperationsDialog then wait()s on the GUI thread until the signing finishes or the external signer returns, with no progress UI. The completed PSBT and pqc_usage are destroyed unseen. The progress events after a raced cancel also update a hidden dialog, so the user sees nothing for the remaining signing.

  • Evidence: Code trace. Qt documents that QProgressDialog::cancel() "becomes hidden" and that canceled() is connected to cancel() by default. Not reproduced. dialogDestructionBeforeCompletion tests destruction only before reservation (allow_psbt_reservation=false).

Impact

The application looks hung for up to the signing duration. Stateful PQC capacity is consumed with no report. Compare AskPassphraseDialog, which ignores reject while encrypting (askpassphrasedialog.cpp:258-262 in #178).

Suggested fix

Override reject()/closeEvent() to ignore requests while m_sign_thread is set. Keep the progress dialog visible after a non-reserved Cancel (call show() as the reserved branch does) until the worker reports. Add a test that closes the dialog after reservation.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. kiwidream commented on Nov 6, 2026

    @kiwidream
    MemberAuthor

    Fixed on 1.x.x by #344 (merged as b5486bf). While the worker runs, reject() and closeEvent() are ignored, so Close, Escape and the window manager can no longer close the dialog. A Cancel before reservation shows the progress dialog again until the worker reports, and the progress dialog ignores Escape once Cancel is gone. Covered by closeIgnoredWhileSigning and canceledProgressStaysVisibleUntilWorkerReports. main gets the fix when 1.x.x is integrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions