Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339774

Summary: NPE in org.eclipse.swt.widgets.Link after loosing focus in a popup
Product: [Eclipse Project] Platform Reporter: Andrew Eisenberg <andrew.eisenberg>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: pinnamur
Version: 3.6.2   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Andrew Eisenberg CLA 2011-03-11 19:34:04 EST
Using either 32 or 64 bit Cocoa SWT, I am consistently getting the exception below.  Here is how to reproduce:

1. Unzip 3.6.2 SDK for Mac Cocoa 32 bit
2. Open a new workspace
3. Create Java project and class.  Here is the text of the class to make:

class Foo {
  Entry e;
}

4. Hover over the underlined "Entry" and click on the "java.util.Map" quickfix.
5. Window goes away, quickfix is applied, and an exception in the error log.

I dug a little bit into this.  It looks like the method org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover.AnnotationInformationControl.apply(ICompletionProposal, ITextViewer, int, boolean) is being called from the control flow of Link.textView_clickOnLink_atIndex.

And on line 510, dispose() is called.  This disposes the Shell, which transitively disposes the Link widget.  By the time that the dispose is finished and control is sent back to the Link widget, all its fields are nulled out, hence the NPE on line 117.


java.lang.NullPointerException
	at org.eclipse.swt.widgets.Link.textView_clickOnLink_atIndex(Link.java:117)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5227)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.mouseDownSuper(Widget.java:1025)
	at org.eclipse.swt.widgets.Widget.mouseDown(Widget.java:1021)
	at org.eclipse.swt.widgets.Control.mouseDown(Control.java:2263)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4983)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1959)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2025)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5047)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4589)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4666)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:115)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3281)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
Comment 1 Andrew Eisenberg CLA 2011-03-11 19:35:25 EST
As an update to this, I had colleagues try this on their machines (linux, windows, and mac), and none could reproduce the problem.  I find this strange.
Comment 2 Praveen CLA 2011-03-12 13:21:19 EST

*** This bug has been marked as a duplicate of bug 324497 ***