mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-17 00:07:49 +00:00
fix concurrent modification exception when trades added to main view
This commit is contained in:
parent
f9afd44345
commit
dd71423d95
2 changed files with 8 additions and 6 deletions
|
@ -1157,12 +1157,14 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Trade> getAllTrades() {
|
public List<Trade> getAllTrades() {
|
||||||
|
synchronized (tradableList) {
|
||||||
List<Trade> trades = new ArrayList<Trade>();
|
List<Trade> trades = new ArrayList<Trade>();
|
||||||
trades.addAll(tradableList.getList());
|
trades.addAll(tradableList.getList());
|
||||||
trades.addAll(closedTradableManager.getClosedTrades());
|
trades.addAll(closedTradableManager.getClosedTrades());
|
||||||
trades.addAll(failedTradesManager.getObservableList());
|
trades.addAll(failedTradesManager.getObservableList());
|
||||||
return trades;
|
return trades;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Trade> getOpenTrades() {
|
public List<Trade> getOpenTrades() {
|
||||||
synchronized (tradableList) {
|
synchronized (tradableList) {
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
tradeManager.applyTradePeriodState();
|
tradeManager.applyTradePeriodState();
|
||||||
|
|
||||||
tradeManager.getObservableList().forEach(trade -> {
|
tradeManager.getOpenTrades().forEach(trade -> {
|
||||||
|
|
||||||
// check initialization error
|
// check initialization error
|
||||||
if (trade.getInitError() != null) {
|
if (trade.getInitError() != null) {
|
||||||
|
|
Loading…
Reference in a new issue