NullPointerException when deleting a shape and closing/opening a turtle view
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Using the sample model from issue #11, update it to extract the view2.5d turtle view setup like below, to be able to call it stand-alone:
to setup-turtle-view
; Set up a Turtle view
view2.5d:turtle-view "Turtle View 1" turtles [ the-turtle -> [.2 * abs xcor] of the-turtle ]
wait 1
view2.5d:set-observer-distance "Turtle View 1" 40
view2.5d:set-z-scale "Turtle View 1" 2
view2.5d:set-observer-angles "Turtle View 1" 25 30
;; increase the stem thickness
view2.5d:set-turtle-stem-thickness "Turtle View 1" .2
view2.5d:update-turtle-view "Turtle View 1" turtles
end
I then could produce an exception reliably with these steps:
- I ran
setupthencreate-arrowand confirmed things looked good in both views. - I went into the shapes editor and deleted the
arrowshape and things updated in both views. - I closed the turtle view.
- I ran
setup-turtle-viewin the command center, and got the below exception.
NetLogo is unable to supply you with more details about this error. Please report the problem
at https://github.com/NetLogo/NetLogo/issues, or to bugs@ccl.northwestern.edu, and paste the
contents of this window into your report.
com.jogamp.opengl.GLException: Caught NullPointerException: null on thread AWT-EventQueue-0
at com.jogamp.opengl.GLException.newGLException(GLException.java:76)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1327)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1442)
at com.jogamp.opengl.Threading.invoke(Threading.java:223)
at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:503)
at com.jogamp.opengl.awt.GLCanvas.paint(GLCanvas.java:557)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:264)
at sun.awt.X11.XRepaintArea.paintComponent(XRepaintArea.java:64)
at sun.awt.RepaintArea.paint(RepaintArea.java:240)
at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:584)
at java.awt.Component.dispatchEventImpl(Component.java:4965)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NullPointerException
at view25d.view.gl.TurtleGL.display(TurtleGL.java:154)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
at com.jogamp.opengl.awt.GLCanvas$11.run(GLCanvas.java:1428)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
... 29 more
NetLogo 6.2.0
main: org.nlogo.app.AppFrame
thread: AWT-EventQueue-0
OpenJDK 64-Bit Server VM 1.8.0_292 (BellSoft; 1.8.0_292-b10)
operating system: Linux 5.8.0-50-generic (amd64 processor)
Scala version 2.12.12
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: test-25dshape-change
08:13:56.408 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:13:56.401 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:13:56.399 AddJobEvent (org.nlogo.app.common.CommandLine) AWT-EventQueue-0
08:13:56.399 OutputEvent (org.nlogo.app.common.CommandLine) AWT-EventQueue-0
08:13:56.399 CompiledEvent (org.nlogo.window.CompilerManager) AWT-EventQueue-0
08:13:56.394 CompileMoreSourceEvent (org.nlogo.app.common.CommandLine) AWT-EventQueue-0
08:13:56.237 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:13:56.037 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:13:55.836 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
08:13:55.636 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
Interestingly, the shape delete is necessary to reproduce the error. Just closing the turtle view isn't enough to trigger it, if you re-run the setup-turtle-view without deleting the shape it'll complete just fine. This error was found with the PR for issue #11 merged, as well as with the bundled version in NetLogo 6.2.0.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with view25d.view.gl.TurtleGL.display at TurtleGL.java:154 and reproduce the sequence in the issue: delete the arrow shape, close the turtle view, then run setup-turtle-view. Trace how the deleted shape and closed view are handled during rendering. Done means the sequence no longer produces a NullPointerException and the turtle view remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- computer-graphics, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100