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

Textures leak when window is resized

    Details

      Description

      The test below, when left running for some time (several minutes on my machine) starts to throw exceptions:

      import javafx.animation.KeyFrame;
      import javafx.animation.Timeline;
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.stage.Stage;
      import javafx.util.Duration;

      public class Test extends Application {
          @Override public void start(final Stage stage) {
              stage.setScene(new Scene(new Group()));
              stage.setWidth(400);
              stage.setHeight(400);
              stage.show();

              Timeline anim = new Timeline(new KeyFrame(Duration.millis(10),
                  new EventHandler<ActionEvent>() {
                      public void handle(ActionEvent ev) {
                          stage.setWidth(1000 - stage.getWidth());
                      }
                  }));
              anim.setCycleCount(Timeline.INDEFINITE);
              anim.play();
          }

          public static void main(String[] args){
              launch(args);
          }
      }

      The exception is
      java.lang.NullPointerException
      at com.sun.prism.impl.BaseGraphics.drawTextureVO(BaseGraphics.java:362)
      at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:331)
      at com.sun.prism.impl.ps.BaseShaderGraphics.drawTexture(BaseShaderGraphics.java:100)
      at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:322)
      at com.sun.prism.d3d.D3DSwapChain.present(D3DSwapChain.java:32)
      at com.sun.javafx.tk.quantum.PaintRunnable.run(PaintRunnable.java:328)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
      at com.sun.prism.render.RenderJob.run(RenderJob.java:29)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at com.sun.javafx.tk.quantum.QuantumRenderer$ObservedRunnable.run(QuantumRenderer.java:67)
      at java.lang.Thread.run(Thread.java:662)

      I've found something suspicious in PaintRunnable.run():
      311 disposePresentable();
      312 presentable = factory.createPresentable(scene.getPlatformView());
      createPresentable() creates a SwapChain and a RTTexture, but disposePresentable() disposes SwapChain only.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kprazdnikwse Kirill.Prazdnikov (Inactive)
                Reporter:
                peterz Peter Zhelezniakov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: