Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350943 - CTabFolder ArrayIndexOutOfBoundsException when disposing CTabItems
Summary: CTabFolder ArrayIndexOutOfBoundsException when disposing CTabItems
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.3 M3   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-01 10:48 EDT by Doug Stevens CLA
Modified: 2013-05-24 09:31 EDT (History)
3 users (show)

See Also:


Attachments
Screen shot of failing condition (620.60 KB, image/bmp)
2011-07-01 10:56 EDT, Doug Stevens CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Stevens CLA 2011-07-01 10:48:03 EDT
Build Identifier: 3.6.1 M20100909-0800

Occurs when a CTabFolder is showing multiple tabs, but the width is set such that not all tabs are visible (i.e. the >> is showing indicating more tabs to be displayed).  The ArrayIndexOutOfBounds exception occurs when the last CTabItem is disposed, regardless of the order in which the CTabItems are disposed, or the number of CTabItems.

If the CTabFolder is wide enough to display all tab headers, then this exception does not occur.   

Stack Trace:

java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.swt.custom.CTabFolder.setButtonBounds(CTabFolder.java:2216)
	at org.eclipse.swt.custom.CTabFolder.destroyItem(CTabFolder.java:476)
	at org.eclipse.swt.custom.CTabItem.dispose(CTabItem.java:126)
	at com.inlethd.manager.fathom.ui.FancyFolderPane.minimize(FancyFolderPane.java:834)
	at com.inlethd.manager.fathom.ui.FancyFolderPane.minimizeExtraFolders(FancyFolderPane.java:776)
	at com.inlethd.manager.fathom.ui.FancyFolderPane.maximize(FancyFolderPane.java:738)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1561)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:261)
	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:4066)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at com.inlethd.manager.fathom.ui.MainApp.run(MainApp.java:251)
	at com.inlethd.manager.fathom.ui.MainApp.main(MainApp.java:554)

Reproducible: Always

Steps to Reproduce:
1. Create a CTabFolder with multiple CTabItems, showing all.
2. Adjust the width of the CTabFolder so that one or more tab header are not displayed (i.e. the >> shows indicating more tab headers). 
3. Attempt to dispose of all CTabItems.  I have been doing this in response to a minimize event.
4. Notice the exception on the last CTabItem dispose().
5. Notice that if in step 2, the width is set such that all tab headers can be displayed (no >> button), the Exception does not occur.
Comment 1 Doug Stevens CLA 2011-07-01 10:56:16 EDT
Created attachment 198971 [details]
Screen shot of failing condition
Comment 2 Doug Stevens CLA 2011-07-01 15:45:52 EDT
One additional piece of information.  This does not occur if the minimize button is selected on the CTabFolder, but rather occurs when the Folder contents are being removed due another action (in my case, the tab items are being removed due to a maximize event on different Folder).
Comment 3 Felipe Heidrich CLA 2011-07-05 10:46:49 EDT
it that still a bug Bog ?
Comment 4 Doug Stevens CLA 2011-07-05 11:04:50 EDT
Yes, I'm still seeing it.  I have an easy work around (handle the exception), so not a high priority.
Comment 5 Doug Stevens CLA 2012-10-03 12:33:16 EDT
This problem no longer occurs in Eclipse/SWT 3.7.2