| Summary: | AIOOBE thrown when destroying the non-zeroth item when tabs are obscured | ||
|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Remy Suen <remy.suen> |
| Component: | UI | Assignee: | Project Inbox <e4.ui-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | gheorghe, Olivier_Thomann |
| Version: | 1.0 | ||
| Target Milestone: | 4.1 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Olivier, this is the CTabFolder bug that's caused by the first item being obscured if the stack is resized "too small". Fixed in HEAD > 20110426 *** Bug 343440 has been marked as a duplicate of this bug. *** |
1. Run the code below. 2. Resize the sash so that the tabs are obscured. Basically, drag the sash's line so it is on top of the second tab and then release the drag. 3. Now click the button on the right to dispose the second (index 1) item. 4. The program crashes with an AIOOBE. Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); SashForm form = new SashForm(shell, SWT.HORIZONTAL); CTabFolder folder = new CTabFolder(form, SWT.NONE); CTabItem item1 = new CTabItem(folder, SWT.NONE); item1.setText("abc"); item1.setControl(new Composite(folder, SWT.NONE)); final CTabItem item2 = new CTabItem(folder, SWT.NONE); item2.setText("abc"); item2.setControl(new Composite(folder, SWT.NONE)); folder.setSelection(item2); final Button b = new Button(form, SWT.PUSH); b.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { item2.dispose(); } }); form.setWeights(new int[] { 50, 50 }); shell.setSize(300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); ---------------------- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at org.eclipse.e4.ui.widgets.CTabFolder.computeControlBounds(CTabFolder.java:594) at org.eclipse.e4.ui.widgets.CTabFolder.getWrappedHeight(CTabFolder.java:3795) at org.eclipse.e4.ui.widgets.CTabFolder.getClientArea(CTabFolder.java:782) at org.eclipse.e4.ui.widgets.CTabFolder.setSelection(CTabFolder.java:2876) at org.eclipse.e4.ui.widgets.CTabFolder.setSelection(CTabFolder.java:2888) at org.eclipse.e4.ui.widgets.CTabFolder.destroyItem(CTabFolder.java:720) at org.eclipse.e4.ui.widgets.CTabItem.dispose(CTabItem.java:126) at Shelll$1.handleEvent(Shelll.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.Display.runDeferredEvents(Display.java:4163) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752) at Shelll.main(Shelll.java:56)