Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Be more aggressive about reporting FX UI thread violations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehearn committed Dec 16, 2014
1 parent 80a868d commit 7a46ec5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/src/main/java/lighthouse/utils/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.util.concurrent.Uninterruptibles;
import com.sun.prism.GraphicsPipeline;
import com.sun.prism.sw.SWPipeline;
import com.vinumeris.crashfx.CrashWindow;
import javafx.animation.*;
import javafx.application.Platform;
import javafx.beans.binding.BooleanBinding;
Expand Down Expand Up @@ -44,7 +45,6 @@
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;

import static com.google.common.base.Preconditions.checkState;
import static lighthouse.protocol.LHUtils.unchecked;

public class GuiUtils {
Expand Down Expand Up @@ -248,7 +248,13 @@ public static void brightnessUnadjust(Node node) {
}

public static void checkGuiThread() {
checkState(Platform.isFxApplicationThread());
if (!Platform.isFxApplicationThread()) {
// Don't just throw directly here to avoid missing the problem when buggy code swallows the exceptions.
IllegalStateException ex = new IllegalStateException();
log.error("Threading violation: not on FX UI thread", ex);
CrashWindow.open(ex);
throw ex;
}
}

public static BooleanBinding conjunction(List<BooleanProperty> list) {
Expand Down

0 comments on commit 7a46ec5

Please sign in to comment.