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

Bug 337148

Summary: Table sends MeasureItem event with index == -1 (was: NPE in OwnerDrawLabelProvider)
Product: [Eclipse Project] Platform Reporter: Olivier Thomann <Olivier_Thomann>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: bill2004158, cps, daniel_megert, eclipse.felipe, eclipse, gattacus, heiko.boettger, kuebler, markus.kell.r, Michael_Rennie, peblpebl, prakash, pwebster, remy.suen, tom.schindl
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Olivier Thomann CLA 2011-02-14 12:55:06 EST
Using eclipse.buildId=I20110210-2002 (4.1 build)
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_CA
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -console,

I got this exception in the .log file.
No steps to reproduce yet as I didn't get any dialog about this error.

java.lang.NullPointerException
at org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:48)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Table.sendMeasureItemEvent(Table.java:3766)
at org.eclipse.swt.widgets.Table.wmNotifyToolTip(Table.java:7129)
at org.eclipse.swt.widgets.Table.wmNotify(Table.java:6571)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5090)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4563)
at org.eclipse.swt.widgets.Table.windowProc(Table.java:5833)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4933)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2418)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4601)
at org.eclipse.swt.widgets.Table.windowProc(Table.java:5833)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4946)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2524)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3713)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog.open(FilteredTypesSelectionDialog.java:500)
at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.runWithEvent(OpenTypeAction.java:78)
at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:65)
at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:141)
at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:58)
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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:207)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:123)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:122)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:266)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:465)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:515)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:348)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:294)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:76)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4618)
at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5890)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4507)
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5886)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4933)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2524)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3713)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:842)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:758)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:87)
at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:540)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:522)
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:344)
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:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 1 Dani Megert CLA 2011-02-15 02:58:24 EST
viewer.getViewerColumn(event.index) returns null.

Maybe this is the opposite of SWT bug 280537 where the handleEvent is sent before the table is fully realized?
Comment 2 Markus Keller CLA 2011-06-20 06:46:33 EDT
*** Bug 349474 has been marked as a duplicate of this bug. ***
Comment 3 Markus Keller CLA 2011-06-20 06:59:53 EDT
Moving to SWT. Looks like the OwnerDrawListener gets an invalid column index in the MeasureItem event sent from Table.wmNotifyToolTip(Table.java:7189)

Bug 331100 and bug 216070 look similar (but in those cases, the table items have fonts set).
Comment 4 Felipe Heidrich CLA 2011-06-22 12:34:36 EDT
(In reply to comment #3)
> Bug 331100 and bug 216070 look similar (but in those cases, the table items
> have fonts set).

possible

Markus, can you reproduce this problem  ?
Comment 5 Markus Keller CLA 2011-06-22 13:34:45 EDT
> Markus, can you reproduce this problem  ?

Nope. I even tried delaying some events with breakpoints and play with different mouse positions to trigger tooltips of items that are not fully there yet.
Comment 6 Peter Larsen CLA 2011-12-05 08:16:41 EST
I coworker sent his .log to me, because he had some problems. 
So I don't know anything about how it happened and it is old.

!SESSION 2011-09-29 10:39:44.441 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product


!ENTRY org.eclipse.ui 4 0 2011-10-04 12:45:07.914
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:48)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Table.sendMeasureItemEvent(Table.java:3766)
	at org.eclipse.swt.widgets.Table.wmNotifyToolTip(Table.java:7189)
	at org.eclipse.swt.widgets.Table.wmNotify(Table.java:6631)
	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2424)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog.open(FilteredResourcesSelectionDialog.java:410)
	at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.queryFileResource(OpenResourceHandler.java:159)
	at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.execute(OpenResourceHandler.java:93)
	at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.run(OpenResourceHandler.java:181)
	at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
	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:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 7 Thomas Singer CLA 2012-03-05 05:50:36 EST
A couple of our SmartGit 3 users also report this bug.
Comment 8 Markus Keller CLA 2012-03-05 11:18:52 EST
(In reply to comment #7)
> A couple of our SmartGit 3 users also report this bug.

Sorry, there's no information in this statement that could help tracking this down. Please ask you users for stack traces and any info they have about the circumstances (e.g. steps to reproduce, even if they only work sometimes).
Comment 9 Thomas Singer CLA 2012-03-05 12:15:38 EST
SmartGit steps from user:

"Went to the log view, turned on the Date column and then turned off the
Commit Date column but instead the internal error screen appeared."

os.arch                      : "x86"
os.name                      : "Windows 7"
java.runtime.version         : "1.7.0-b147"

java.lang.NullPointerException
	at org.eclipse.swt.widgets.Widget.getData(Widget.java:558)
	at org.eclipse.jface.viewers.ColumnViewer.getViewerColumn(ColumnViewer.java:186)
	at org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Table.sendMeasureItemEvent(Table.java:3766)
	at org.eclipse.swt.widgets.Table.CDDS_SUBITEMPREPAINT(Table.java:998)
	at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:6840)
	at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5534)
	at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1896)
	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2427)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Widget.wmPaint(Widget.java:2273)
	at org.eclipse.swt.widgets.Control.WM_PAINT(Control.java:5090)
	at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1406)
	at org.eclipse.swt.widgets.Table.WM_PAINT(Table.java:6222)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4585)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2427)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
	at org.eclipse.swt.internal.win32.OS.SendMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.SendMessage(OS.java:3277)
	at org.eclipse.swt.widgets.Table.destroyItem(Table.java:2066)
	at org.eclipse.swt.widgets.TableColumn.destroyWidget(TableColumn.java:194)
	at org.eclipse.swt.widgets.Widget.release(Widget.java:818)
	at org.eclipse.swt.widgets.Widget.dispose(Widget.java:446)
Comment 10 Thomas Singer CLA 2012-03-05 12:19:15 EST
os.arch                      : "x86"
os.name                      : "Windows 7"
java.runtime.version         : "1.7.0-b147"

java.lang.NullPointerException
	at org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:48)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Table.sendMeasureItemEvent(Table.java:3766)
	at org.eclipse.swt.widgets.Table.wmNotifyToolTip(Table.java:7189)
	at org.eclipse.swt.widgets.Table.wmNotify(Table.java:6631)
	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2427)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2533)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
Comment 11 Thomas Singer CLA 2012-03-05 12:22:45 EST
We are using the SWT/JFace jars from 3.8M2.

(In reply to comment #9)
> SmartGit steps from user:
> 
> "Went to the log view, turned on the Date column and then turned off the
> Commit Date column but instead the internal error screen appeared."
> 
> os.arch                      : "x86"
> os.name                      : "Windows 7"
> java.runtime.version         : "1.7.0-b147"
> 
> java.lang.NullPointerException
>     at org.eclipse.swt.widgets.Widget.getData(Widget.java:558)
>     at
> org.eclipse.jface.viewers.ColumnViewer.getViewerColumn(ColumnViewer.java:186)
>     at
> org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:47)
>     at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

Looks like a slightly different NPE, but also related to OwnerDrawLabelProvider$OwnerDrawListener.handleEvent
Comment 12 Markus Keller CLA 2012-03-05 13:33:26 EST
(In reply to comment #9)
> java.lang.NullPointerException
>     at org.eclipse.swt.widgets.Widget.getData(Widget.java:558)
>     at
> org.eclipse.jface.viewers.ColumnViewer.getViewerColumn(ColumnViewer.java:186)

That looks like someone is playing games with the package-private Widget#data field. I'm afraid we can't help much here, and you have to debug it in SmartGit.

Code from Widget.java:

public Object getData (String key) {
	checkWidget();
	if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
	if ((state & KEYED_DATA) != 0) {
		Object [] table = (Object []) data;
		for (int i=1; i<table.length; i+=2) { // NPE on this line
Comment 13 Thomas Singer CLA 2012-03-06 07:51:47 EST
(In reply to comment #12)
> (In reply to comment #9)
> > java.lang.NullPointerException
> >     at org.eclipse.swt.widgets.Widget.getData(Widget.java:558)
> >     at
> > org.eclipse.jface.viewers.ColumnViewer.getViewerColumn(ColumnViewer.java:186)
> 
> That looks like someone is playing games with the package-private Widget#data
> field. I'm afraid we can't help much here, and you have to debug it in
> SmartGit.
> 
> Code from Widget.java:
> 
> public Object getData (String key) {
>     checkWidget();
>     if (key == null) error (SWT.ERROR_NULL_ARGUMENT);
>     if ((state & KEYED_DATA) != 0) {
>         Object [] table = (Object []) data;
>         for (int i=1; i<table.length; i+=2) { // NPE on this line

Thank you very much for this hint. There are indeed some usages of widget.setData(obj) in our code. I replace them with widget.setData(key, obj) with a surely unique key (and, of course, the corrsponding getData invocations).
Comment 14 Markus Keller CLA 2012-03-08 07:15:52 EST
If you really had a conflict with the null data key, then you would see this all the time. But in this case, you seem to have an NPE because Widget#table is null. This shouldn't ever happen, and I didn't find any execution paths in SWT that would make this happen.
Comment 15 Thomas Singer CLA 2012-03-13 12:14:43 EDT
(In reply to comment #14)
> If you really had a conflict with the null data key, then you would see this
> all the time. But in this case, you seem to have an NPE because Widget#table is
> null. This shouldn't ever happen, and I didn't find any execution paths in SWT
> that would make this happen.

I have found a way to reproduce the bug by adding two table columns and removing the first of the two added. We are trying to extract the essential code into a small example and report a separate bug.
Comment 16 Thomas Singer CLA 2012-04-05 05:37:41 EDT
(In reply to comment #15)
> I have found a way to reproduce the bug by adding two table columns and
> removing the first of the two added. We are trying to extract the essential
> code into a small example and report a separate bug.

see bug 258282
Comment 17 Markus Keller CLA 2012-04-05 07:18:00 EDT

*** This bug has been marked as a duplicate of bug 258282 ***
Comment 18 Markus Keller CLA 2012-04-10 06:10:36 EDT
This bug is about the NPE at
org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:48) which is triggered by a Table.wmNotifyToolTip(..).

Comment 9 to 17 mostly talk about bug 258282, which is an NPE in Widget.getData(..).

Reopening this bug, since it's not clear that these two bugs are related.
Comment 19 Markus Keller CLA 2012-04-10 06:11:07 EDT
*** Bug 364190 has been marked as a duplicate of this bug. ***
Comment 20 Markus Keller CLA 2012-04-20 13:47:57 EDT
Finally found steps to reproduce in I20120419-1434 (3.8), Windows 7.

Reason for the NPE: We get a bad MeasureItem event with index == -1 when the mouse is on the left of the table widget and the table selection changes (after a short delay).

This can also be seen in the ControlExample if you hack Event#toString() to print the index.


Steps to get the NPE:
- new workspace
- paste this into Package Explorer:
package p;
public class C {
	public static void main(String[] args) {
		int i= 2;
		System.out.println(i);
	}
}
- Open Resource... (Ctrl+Shift+R)
- type **
- press ArrowDown
- put the mouse cursor to the left of the first item in the list (outside of the table widget)
- expand/reduce the selection with Shift+ArrowDown/Up
=> each selection change triggers an NPE (after a short delay)

java.lang.NullPointerException
        at org.eclipse.jface.viewers.OwnerDrawLabelProvider$OwnerDrawListener.handleEvent(OwnerDrawLabelProvider.java:48)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
        at org.eclipse.swt.widgets.Table.sendMeasureItemEvent(Table.java:3766)
        at org.eclipse.swt.widgets.Table.wmNotifyToolTip(Table.java:7189)
        at org.eclipse.swt.widgets.Table.wmNotify(Table.java:6631)
        at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
        at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4976)
        at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
        at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2439)
        at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
        at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
        at org.eclipse.swt.widgets.Table.windowProc(Table.java:5893)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2545)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
        at org.eclipse.jface.window.Window.open(Window.java:801)
        at org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog.open(FilteredResourcesSelectionDialog.java:410)
        at org.eclipse.ui.internal.ide.handlers.OpenResourceHandler.queryFileResource(OpenResourceHandler.java:159)
...
Comment 21 Markus Keller CLA 2012-04-29 12:07:20 EDT
I don't want to ship with the NPE, and there's an easy workaround in jface, so I released that.

R3_development: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=0af8882f6866c9ec182a7d96756a21d223524686

master: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=fb8e41bf8eaf5d1d19db2d83e271ee306edd8a0e
Comment 22 Paul Webster CLA 2012-04-30 08:05:19 EDT
(In reply to comment #21)
> I don't want to ship with the NPE, and there's an easy workaround in jface, so
> I released that.

Thanx Markus.

PW
Comment 23 Paul Webster CLA 2012-05-10 10:22:01 EDT
*** Bug 379124 has been marked as a duplicate of this bug. ***
Comment 24 Eclipse Genie CLA 2020-04-04 01:25:31 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.