Skip to content

[macOS] Tree widget NullPointerException in checkData() - cannot read field "cached" because "item" is null #2194

Open
@qforce85

Description

@qforce85

Describe the bug

SWT Tree widget throws NullPointerException during normal operation on macOS. The error occurs in Tree.checkData() method when trying to access the "cached" field of a null "item" object. This happens during tree rendering/display operations and results in cascading failures with multiple suppressed exceptions.

Stack trace:

java.lang.NullPointerException: Cannot read field "cached" because "item" is null
	at org.eclipse.swt.widgets.Tree.checkData(Tree.java:328)
	at org.eclipse.swt.widgets.Tree.outlineView_objectValueForTableColumn_byItem(Tree.java:2238)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6764)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5705)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5845)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:117)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4000)
	at com.docfetcherpro.util.UtilSwt$.mainLoopHandled(UtilSwt.scala:146)
	at com.docfetcherpro.MainDesktop$.main(MainDesktop.scala:238)
	at com.docfetcherpro.MainDesktop.main(MainDesktop.scala)
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "cached" because "item" is null
		... 12 more
	Suppressed: java.lang.NullPointerException: Cannot read field "image" because "item" is null
		at org.eclipse.swt.widgets.Tree.outlineView_willDisplayCell_forTableColumn_item(Tree.java:2316)
		at org.eclipse.swt.widgets.Display.windowProc(Display.java:6814)
		... 9 more

To Reproduce

According to the user who reported this crash, the application was "open and idle in the background for days" before they interacted with the UI and triggered the crash. I have not seen this specific crash reported before across my userbase. This suggests the issue might be difficult or impossible to reproduce reliably.

Expected behavior

Tree widget should display normally without throwing NullPointerException.

Environment:

  1. Select the platform(s) on which the behavior is seen:
  • All OS
  • Windows
  • Linux
  • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    macOS 14.7 on x86_64

  2. JRE/JDK version
    OpenJDK Runtime Environment 17.0.10+7

Version since

SWT 4.34

Workaround (or) Additional context

No known workaround at this time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions