add and remove offers on user thread to fix illegal state #1031

This commit is contained in:
woodser 2024-06-20 11:53:15 -04:00
parent 26a5ffcb31
commit cb0b6665f7
2 changed files with 30 additions and 24 deletions

View file

@ -19,6 +19,8 @@ package haveno.desktop.main.market.offerbook;
import com.google.common.math.LongMath;
import com.google.inject.Inject;
import haveno.common.UserThread;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.locale.CurrencyUtil;
import haveno.core.locale.GlobalSettings;
@ -135,10 +137,12 @@ class OfferBookChartViewModel extends ActivatableViewModel {
currenciesUpdatedListener = (observable, oldValue, newValue) -> {
if (!isAnyPriceAbsent()) {
offerBook.fillOfferBookListItems();
updateChartData();
var self = this;
priceFeedService.updateCounterProperty().removeListener(self.currenciesUpdatedListener);
UserThread.execute(() -> {
offerBook.fillOfferBookListItems();
updateChartData();
var self = this;
priceFeedService.updateCounterProperty().removeListener(self.currenciesUpdatedListener);
});
}
};