mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
a71f1e7e3f
The runAfter* methods delegate to UITimer::run(Later|Periodically) in the case of the desktop application. These use the JavaFX TimeLine API (via bisq.common.reactfx.FXTimer) to schedule future events. However, this API isn't thread safe and isn't meant to be called outside the FX application thread. This causes occasional misfirings and out-of-order scheduling when UserThread::runAfter is called outside the user thread. Make the UITimer::run* methods safe to call from any thread by checking we are in the application thread and delegating to UserThread::execute otherwise. This also improves consistency between the contracts of the runAfter* and execute methods. As the former has many call sites, this is safer than trying to track down all the non-thread-safe uses. (The Timer used in the headless app already appears to be thread-safe.) This fixes #4055 (Bisq sometimes fails to prompt user for password to unlock wallet), caused by out-of-order scheduling of the execute and runAfter tasks in the WalletConfig.onSetupCompleted anonymous class method in bisq.core.btc.setup.WalletsSetup.initialize. Also prevent an exception caused by non-thread-safe calls into JavaFX during the shutdown of OpenOfferManager, which was uncovered by the above, by adding a missing UserThread::execute call. |
||
---|---|---|
.. | ||
package | ||
src |