JDK-8114439 : NullPointerException happens if a ListView is resized many times
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2011-06-30
  • Updated: 2015-06-16
  • Resolved: 2011-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
fx2.0Resolved
Related Reports
Duplicate :  
Duplicate :  
Description
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);
    }
}
Comments
SQE: verified on 2.0.2 b08.
11-11-2011

OK, thanks. I think we've done due diligence and should mark this as a duplicate of the more generic texture leak issue.
31-08-2011

Using presidio-graphics-scrum repo equivalent to build #2813 could not reproduce after 10 minutes manual resizing of the list nor 15 minutes automated resizing as in this modified test case: package rt14644; 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; import javafx.stage.Window; /** * * @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); final Scene scene = new Scene(box, 200, 300); stage.setScene(scene); stage.show(); //stage.setVisible(true); Runnable loop = new Runnable() { public void run() { Window window = scene.getWindow(); double degsToRads = Math.PI/180.0; while (true) { for (double degrees = 0.0; degrees < 360.0; degrees += 0.1) { double radians = degrees*degsToRads; double w = 512.0*Math.cos(radians); double h = 512.0*Math.sin(radians); window.setWidth(w); window.setHeight(h); } } } }; Thread t = new Thread(loop); t.start(); } public static void main(final String[] args) { Application.launch(ListViewCellFactoryIssue.class, args); } }
31-08-2011

This is probably a duplicate of RT-15961 (i.e., RT-15961 is likely the root cause of this issue).
26-08-2011

This may be a texture leak of some sort that is triggered by a resize.
26-08-2011

Problem is happening here PixelFormat format = tex.getPixelFormat(); so the Texture being passed in somehow becomes null.
26-08-2011

Was able to reproduce with graphics-scrum b2771 on Windows XP after about 3 minutes.
26-08-2011

Just reproduced it with an app that draws a cube of 6 rectangles. Looks like memory leak or something. Try to make the window as big as possible while resizing to reproduce it quicker. java.lang.NullPointerException at com.sun.prism.impl.BaseGraphics.drawTextureVO(BaseGraphics.java:374) at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:343) at com.sun.prism.impl.ps.BaseShaderGraphics.drawTexture(BaseShaderGraphics.java:96) at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:334) at com.sun.prism.d3d.D3DSwapChain.present(D3DSwapChain.java:32) 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)
15-07-2011

Same as other NPE's... needs better description. I sat for 5 minutes shaking mouse with nothing on my machine.
14-07-2011

Looks like a graphics issue
30-06-2011