stop the send tab transaction preview from opening a cleared transaction in the expanded popup
What changed, and why it matters
This commit fixes a UI bug in Sparrow Wallet's transaction preview diagram. Previously, when a transaction was cleared from the send tab, the small diagram would empty out but it could still open an expanded popup if the user clicked on it, because the click handler and the reference to the old transaction were not removed. The fix introduces a proper clear() method that removes both the click and right-click handlers and nulls out the stored transaction, so a cleared diagram no longer responds to user interaction.
Treat as a low-severity UI consistency fix. Review whether any other tabs or diagram instances clear state by only removing children without detaching handlers or nulling data. No immediate security response is indicated unless user-confusion or stale-data exposure is shown to be exploitable.
Security signals we found
UI state desynchronization between displayed data and stored transaction object
Event handlers retained after underlying data was cleared
Potential for stale transaction preview to be re-opened after wallet state change
Evidence from the diff
TransactionDiagram.update(WalletTransaction) previously called getChildren().clear() directly when walletTx was null, leaving this.walletTx unchanged and both setOnMouseClicked(expandedDiagramHandler) and setOnContextMenuRequested(contextMenuHandler) still registered. The patch centralizes cleanup into a new clear() method that sets walletTx = null, removes the mouse-clicked and context-menu handlers, and clears child nodes. It also moves the label update inside the non-null branch and moves setOnContextMenuRequested(contextMenuHandler) outside the conditional that builds the context menu, ensuring the handler is always attached when a transaction is present and removed on clear.
Changed components
src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.javaSend tab transaction preview / diagram popupInspect captured patch +9 / −6
### src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java
@@ -184,26 +184,26 @@ public void update(WalletTransaction walletTx) {
setMaxHeight(getDiagramHeight());
if(walletTx == null) {
- getChildren().clear();
+ clear();
} else {
this.walletTx = walletTx;
update();
setOnMouseClicked(expandedDiagramHandler);
if(expandedDiagram != null) {
updateDerivedDiagram(expandedDiagram);
}
- }
- if(getLabel() != null) {
- getLabel().update(this);
+ if(getLabel() != null) {
+ getLabel().update(this);
+ }
}
}
public void update(String message) {
setMinHeight(getDiagramHeight());
setMaxHeight(getDiagramHeight());
- getChildren().clear();
+ clear();
VBox messagePane = new VBox();
messagePane.setPrefHeight(getDiagramHeight());
@@ -220,6 +220,9 @@ public void update(String message) {
}
public void clear() {
+ walletTx = null;
+ setOnMouseClicked(null);
+ setOnContextMenuRequested(null);
getChildren().clear();
}
@@ -286,8 +289,8 @@ public void update() {
saveAsImage();
});
contextMenu.getItems().add(menuItem);
- setOnContextMenuRequested(contextMenuHandler);
}
+ setOnContextMenuRequested(contextMenuHandler);
}
private List<Map<BlockTransactionHashIndex, WalletNode>> getDisplayedUtxoSets() {Why this scored 25/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.