Bug 175192 - [Viewers] Loop exception on shutdown
Summary: [Viewers] Loop exception on shutdown
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-22 16:02 EST by Eric Moffatt CLA
Modified: 2007-03-23 04:08 EDT (History)
2 users (show)

See Also:


Attachments
Passing -1 is of course the bug (1.11 KB, patch)
2007-02-23 10:01 EST, Thomas Schindl CLA
no flags Details | Diff
Right somehow this was not included in my patch (1.35 KB, patch)
2007-02-23 10:35 EST, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Moffatt CLA 2007-02-22 16:02:14 EST
I've been getting a spurious error on shutdown during my debugging sessions recently. Sorry but I haven't been able to nail down the circumstances that cause it to happen.

Here's the callstack:

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: Index out of bounds)
	at org.eclipse.swt.SWT.error(SWT.java:3478)
	at org.eclipse.swt.SWT.error(SWT.java:3401)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:126)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3467)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3107)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2264)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2228)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2103)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:457)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:452)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:101)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:146)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1124)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1099)
Caused by: java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:3462)
	at org.eclipse.swt.SWT.error(SWT.java:3401)
	at org.eclipse.swt.SWT.error(SWT.java:3372)
	at org.eclipse.swt.widgets.TreeItem.findPrevious(TreeItem.java:222)
	at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:189)
	at org.eclipse.jface.viewers.TreeViewer.createNewRowPart(TreeViewer.java:686)
	at org.eclipse.jface.viewers.TreeViewer.newItem(TreeViewer.java:315)
	at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:798)
	at org.eclipse.jface.viewers.AbstractTreeViewer.insert(AbstractTreeViewer.java:2818)
	at org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer.insert(InternalTreeModelViewer.java:422)
	at org.eclipse.debug.internal.ui.viewers.model.ChildrenUpdate.performUpdate(ChildrenUpdate.java:70)
	at org.eclipse.debug.internal.ui.viewers.model.ViewerUpdateMonitor$1.runInUIThread(ViewerUpdateMonitor.java:58)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
	... 23 more
Comment 1 Eric Moffatt CLA 2007-02-22 16:05:29 EST
I'm in the debug perspective and the error occurs when I'm closing down the debug session by closing the 'outer' window (i.e. normal shutdown of the outer).

I'll keep my eyes open to see if I can find a repeatable scenario...
Comment 2 Boris Bokowski CLA 2007-02-22 16:18:40 EST
This seems like a bug in AbstractTreeViewer.insert(Object,Object,int).  The code looks like this:

int insertionPosition = position;
if (insertionPosition == -1) {
	insertionPosition = getItemCount((Control) widget);
}
createTreeItem(widget, element, position);

We compute an insertionPosition but never use it...
Comment 3 Thomas Schindl CLA 2007-02-23 10:01:29 EST
Created attachment 59658 [details]
Passing -1 is of course the bug

As Boris already discovered this is of course not correct
Comment 4 Boris Bokowski CLA 2007-02-23 10:29:47 EST
Tom, there are at least two places in the code where we don't use insertionPosition...
Comment 5 Thomas Schindl CLA 2007-02-23 10:35:18 EST
Created attachment 59663 [details]
Right somehow this was not included in my patch
Comment 6 Nick Edgar CLA 2007-02-26 16:13:00 EST
I just saw this too.
Comment 7 Boris Bokowski CLA 2007-02-26 16:32:42 EST
Released >20070226.
Comment 8 Thomas Schindl CLA 2007-03-23 04:08:40 EDT
Verified by code inspection in I20070321-1800