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

Bug 323739

Summary: NPE while using auto complete
Product: [Eclipse Project] Platform Reporter: Chris Aniszczyk <caniszczyk>
Component: SWTAssignee: Scott Kovatch <skovatch>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, Silenio_Quarti, zregvart+eclipse
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Chris Aniszczyk CLA 2010-08-26 14:08:14 EDT
This bug drives me a bit crazy.

I get this usually when I try to use a quickfix or autocomplete. After this happens, it breaks code completion amongst other things... painful... not sure if this is SWT or JDT...

eclipse.buildId=I20100805-1700
java.version=1.6.0_20
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/chrisaniszczyk/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -keyring /Users/chrisaniszczyk/.eclipse_keyring -showlocation


Error
Thu Aug 26 13:04:08 CDT 2010
java.lang.NullPointerException

java.lang.NullPointerException
	at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1884)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:171)
	at org.eclipse.swt.graphics.GC.<init>(GC.java:134)
	at org.eclipse.swt.custom.StyledTextRenderer.setFont(StyledTextRenderer.java:1106)
	at org.eclipse.swt.custom.StyledText.<init>(StyledText.java:1256)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameInformationPopup.createContent(RenameInformationPopup.java:673)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameInformationPopup.open(RenameInformationPopup.java:301)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.openSecondaryPopup(RenameLinkedMode.java:596)
	at org.eclipse.jdt.internal.ui.refactoring.reorg.RenameLinkedMode.start(RenameLinkedMode.java:274)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:201)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.doRun(RenameJavaElementAction.java:148)
	at org.eclipse.jdt.internal.ui.refactoring.actions.RenameJavaElementAction.run(RenameJavaElementAction.java:129)
	at org.eclipse.jdt.ui.actions.RenameAction.run(RenameAction.java:115)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:278)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1032)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3789)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1404)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1400)
	at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:416)
	at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:594)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5008)
	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:1943)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2047)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5070)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4612)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4689)
	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:3288)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	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:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 1 Scott Kovatch CLA 2010-08-27 18:58:22 EDT
Looks like we're getting a GC on a window that isn't visible yet, but we defend against that on Control.java:1879 by forcing it to be created.

The next time this happens can you check for a log message in Console.app?
Comment 2 Zoran Regvart CLA 2011-01-10 08:45:12 EST
hi,

this is from the console.app at the time the exception occurred:

10.01.2011. 14:39:24	eclipse[3148]	Exception detected while handling key input.
10.01.2011. 14:39:41	eclipse[3148]	CGSResolveShmemReference : window.RO : Reference offset (37664) exceeds bounds (32768) on shmem obj 0xb1e
10.01.2011. 14:39:41	eclipse[3148]	kCGErrorFailure: CGSNewWindowWithOpaqueShape: Cannot map window information shmem
10.01.2011. 14:39:41	eclipse[3148]	kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
10.01.2011. 14:39:41	eclipse[3148]	kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
10.01.2011. 14:39:41	eclipse[3148]	Failed to create window context device
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Warning>: CGSResolveShmemReference : window.RO : Reference offset (37664) exceeds bounds (32768) on shmem obj 0xb1e
10.01.2011. 14:39:41	eclipse[3148]	CGWindowContextCreate: failed to create context delegate.
10.01.2011. 14:39:41	eclipse[3148]	_initWithWindowNumber: error creating graphics ctxt object for ctxt:0x17fa3, window:0xffffffff
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Error>: kCGErrorFailure: CGSNewWindowWithOpaqueShape: Cannot map window information shmem
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Error>: Failed to create window context device
10.01.2011. 14:39:41	[0x0-0x12c12c].org.eclipse.eclipse[3148]	Mon Jan 10 14:39:41 zregvart eclipse[3148] <Error>: CGWindowContextCreate: failed to create context delegate.

stack trace is almost the same:


!ENTRY org.eclipse.ui 4 4 2011-01-10 14:39:41.143
!MESSAGE "Content Assist" did not complete normally.  Please see the log for more information.

!ENTRY org.eclipse.ui 4 0 2011-01-10 14:39:41.143
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
        at org.eclipse.swt.widgets.Control.internal_new_GC(Control.java:1851)
        at org.eclipse.swt.graphics.GC.<init>(GC.java:171)
        at org.eclipse.swt.graphics.GC.<init>(GC.java:134)
        at org.eclipse.swt.widgets.Table.computeSize(Table.java:421)
        at org.eclipse.swt.layout.GridData.computeSize(GridData.java:491)
        at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:217)
        at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:193)
        at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1183)
        at org.eclipse.swt.widgets.Composite.resized(Composite.java:932)
        at org.eclipse.swt.widgets.Control.setFrameSize(Control.java:3404)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4968)
        at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
        at org.eclipse.swt.internal.cocoa.NSWindow.setFrame(NSWindow.java:284)
        at org.eclipse.swt.widgets.Shell.setBounds(Shell.java:1431)
        at org.eclipse.swt.widgets.Control.setSize(Control.java:3668)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.createProposalSelector(CompletionProposalPopup.java:614)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$22(CompletionProposalPopup.java:571)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:498)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
        at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660)
        at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:182)
        at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
        at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
        at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
        at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)


hope it helps
Comment 3 Scott Kovatch CLA 2011-01-11 16:46:02 EST
Stumbling around for ideas here.... are you using Spaces with Eclipse? A google search hints that's one way to cause this to happen.

I'm also looking into why the memory consumption is considered to be so large here that we need to do deferred creation.
Comment 4 Scott Kovatch CLA 2011-01-11 16:54:42 EST
(In reply to comment #2)
> hi,
> 
> this is from the console.app at the time the exception occurred:

What version of the OS and which Eclipse build are you using? Thanks in advance.
Comment 5 Zoran Regvart CLA 2011-01-12 16:20:01 EST
(In reply to comment #4)
> (In reply to comment #2)
> > hi,
> > 
> > this is from the console.app at the time the exception occurred:
> 
> What version of the OS and which Eclipse build are you using? Thanks in
> advance.

this is Snow Leopard 10.6.6, uname prints:
Darwin zregvart 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

eclipse version from about is:
Eclipse Java EE IDE for Web Developers.

Version: Helios Release
Build id: 20100617-1415

swt plugin is version:
3.6.0.v3650b

if by Spaces you mean OS X multiple workspaces tech, then yes, extensively, but eclipse is situated on fixed space (set in preferences)

I also have Cinch (http://www.irradiatedsoftware.com/cinch/) installed, that in previous version had an issue with iTunes (caused it to crash), and could be somehow related  (http://getsatisfaction.com/irradiatedsoftware/topics/cinch_causes_itunes_9_1_to_crash_when_in_list_mode_w_column_browser_at_top)

thanks, and sorry for the late reply
Comment 6 Lars Vogel CLA 2019-09-24 13:52:04 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.