Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8357157

Exception thrown from AnimationTimer freezes application

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • jfx24
    • javafx
    • None

      When an exception is thrown from AnimationTimer::handle, the JavaFX application freezes. The reason is that the user exception will bubble up into framework code, preventing the normal operation of JavaFX.

      Reproducer:

      public class FailingAnimationTimer extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              var button = new Button("start timer");
              button.setOnAction(_ -> {
                  var timer = new AnimationTimer() {
                      @Override
                      public void handle(long l) {
                          throw new RuntimeException("foo");
                      }
                  };

                  timer.start();
              });

              var root = new HBox();
              root.getChildren().add(new TextField("test"));
              root.getChildren().add(button);
              stage.setScene(new Scene(root));
              stage.show();
          }
      }

            mstrauss Michael Strauß
            mstrauss Michael Strauß
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: