Skip to content

NullPointerException when closing a FunGraphics window #6

@lucas-it

Description

@lucas-it

I wanted to close an existing window and open a new one with FunGraphics. But when I close a window, an NPE exception is thrown by the internalRender method in AcceleratedDisplay.

java.lang.NullPointerException: Cannot invoke "java.awt.Graphics2D.dispose()" because "g" is null
  at hevs.graphics.AcceleratedDisplay.hevs$graphics$AcceleratedDisplay$$internalRender(AcceleratedDisplay.scala:253)
  at hevs.graphics.AcceleratedDisplay$RenderThread$1.doInBackground(AcceleratedDisplay.scala:204)
  at hevs.graphics.AcceleratedDisplay$RenderThread$1.doInBackground(AcceleratedDisplay.scala:195)
  at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:305)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
  at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:342)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)

Sample code for reproduction:

val window1 = new FunGraphics(300, 300)
window1.mainFrame.dispose()

val window2 = new FunGraphics(400, 400)
window2.mainFrame.dispose()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions