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

NullPointerException happens if a ListView is resized many times

XMLWordPrintable

      NullPointerException happens if a ListView is resized many times

      (JavaFX 2.0 beta b34 + JDK 1.6.0_b25 + WinXP SP3)

      How to re-produce:
      1. Start the sample app(codes below)
      2. Drag the right-bottom corner of the app window to resize the app window
      3. Keep moving your mouse here and there a little quickly, resizing the app
         window drastically
      4. If with good luck, within 1 min, you will see below exception
         (sometimes I could re-produce it within 5 second, but sometimes, 3 minutes)

      The exception is like below:

      java.lang.NullPointerException
      at com.sun.prism.impl.BaseGraphics.drawTextureVO(BaseGraphics.java:363)
      at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:332)
      at com.sun.prism.impl.ps.BaseShaderGraphics.drawTexture(BaseShaderGraphics.java:90)
      at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:323)
      at com.sun.prism.d3d.D3DSwapChain.present(D3DSwapChain.java:29)
      at com.sun.javafx.tk.quantum.PaintRunnable.run(PaintRunnable.java:241)
      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:70)
      at java.lang.Thread.run(Thread.java:662)

      Below codes can be used to re-produce:

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.ListView;
      import javafx.scene.layout.Pane;
      import javafx.scene.layout.Priority;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      /**
       *
       * @author lianqi.li
       */
      public class ListViewCellFactoryIssue extends Application {
          @Override
          public void start(Stage stage) {
              stage.setTitle("ListView Issue");

              final ListView<String> list = new ListView<String>();
              final ObservableList<String> data = FXCollections.observableArrayList(
                  "chocolate", "salmon", "gold", "coral", "darkorchid",
                  "darkgoldenrod", "lightsalmon", "black", "rosybrown",
                  "blue", "blueviolet", "brown"
              );
              list.setItems(data);
              
              Pane box = new VBox();

              box.getChildren().addAll(list);
              VBox.setVgrow(list, Priority.ALWAYS);

              Scene scene = new Scene(box, 200, 300);
              
              stage.setScene(scene);
              stage.setVisible(true);
          }

          public static void main(final String[] args) {
              Application.launch(ListViewCellFactoryIssue.class, args);
          }
      }

            bpb Brian Burkhalter
            lianqli Lianqi Li (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: