Skip to content

Commit

Permalink
Merge pull request #5244 from pkriens/master
Browse files Browse the repository at this point in the history
#5062 JVM crash
  • Loading branch information
pkriens committed May 9, 2022
2 parents ebec1d6 + fdbd861 commit 4f96bc4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bndtools.core/src/bndtools/explorer/Model.java
Expand Up @@ -102,12 +102,27 @@ void onUpdate(Runnable runnable) {
}

void update() {
dirty.set(true);
if (dirty.getAndSet(true))
return;

Display.getDefault()
.asyncExec(this::update0);
}

/*
* This runs async on the display thread.
*/
private void update0() {
try {
// coalesce some more updates on
// the worker thread(s).
Thread.sleep(10);
} catch (InterruptedException e) {
Thread.currentThread()
.interrupt();
return;
}

if (dirty.getAndSet(false)) {
updates.forEach(Runnable::run);
}
Expand Down

0 comments on commit 4f96bc4

Please sign in to comment.