add or remove trade state listeners on jfx thread (#2043)

This commit is contained in:
woodser 2025-11-20 14:28:34 -04:00 committed by GitHub
parent b450b87d0a
commit b525f34e53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -320,12 +320,12 @@ public class PendingTradesDataModel extends ActivatableDataModel {
for (Trade trade : tradeManager.getObservableList()) {
if (isTradeShown(trade)) {
if (hiddenTrades.contains(trade)) {
trade.stateProperty().removeListener(hiddenStateChangeListener);
UserThread.execute(() -> trade.stateProperty().removeListener(hiddenStateChangeListener));
hiddenTrades.remove(trade);
}
} else {
if (!hiddenTrades.contains(trade)) {
trade.stateProperty().addListener(hiddenStateChangeListener);
UserThread.execute(() -> trade.stateProperty().addListener(hiddenStateChangeListener));
hiddenTrades.add(trade);
}
}
@ -390,7 +390,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
takerTxId.set(nullToEmptyString(takerDepositTxHash));
if (makerDepositTxHash != null || takerDepositTxHash != null) {
notificationCenter.setSelectedTradeId(tradeId);
selectedTrade.stateProperty().removeListener(tradeStateChangeListener);
UserThread.execute(() -> selectedTrade.stateProperty().removeListener(tradeStateChangeListener));
}
};
selectedTrade.stateProperty().addListener(tradeStateChangeListener);

View file

@ -544,9 +544,12 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
chatPopupStage.xProperty().removeListener(yPositionListener);
}
UserThread.execute(() -> {
trade.stateProperty().removeListener(tradeStateListener);
trade.disputeStateProperty().addListener(disputeStateListener);
trade.mediationResultStateProperty().addListener(mediationResultStateListener);
});
traderChatManager.requestPersistence();
});