Bug 68031 - Graphic is disposed error in Ctrl+e editor dropdown
Summary: Graphic is disposed error in Ctrl+e editor dropdown
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 3.0 RC4   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-21 12:11 EDT by Michael Van Meekeren CLA
Modified: 2004-06-23 16:38 EDT (History)
2 users (show)

See Also:


Attachments
Workaround in jface (5.53 KB, patch)
2004-06-22 12:25 EDT, Billy Biggs CLA
no flags Details | Diff
New patch which only modifies BasicStackList (1.73 KB, patch)
2004-06-22 13:45 EDT, Billy Biggs CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Van Meekeren CLA 2004-06-21 12:11:27 EDT
build 3.0 RC3

- open more editors then are visible in the editer area
- press Ctrl+e to open the drop down
- arrow down to an item and press the "del" key
- graphic is disposed error is logged

Graphic is disposed
Unhandled event loop exception
Reason:
Graphic is disposed
Comment 1 Michael Van Meekeren CLA 2004-06-21 15:46:25 EDT
billy please investigate
Comment 2 Billy Biggs CLA 2004-06-22 10:57:19 EDT
We believe this is a problem in the SWT implementation of Table on motif.

!ENTRY org.eclipse.ui 4 0 Jun 22, 2004 10:38:57.68
!MESSAGE Graphic is disposed
!STACK 0
org.eclipse.swt.SWTException: Graphic is disposed
	at org.eclipse.swt.SWT.error(SWT.java:2691)
	at org.eclipse.swt.SWT.error(SWT.java:2616)
	at org.eclipse.swt.SWT.error(SWT.java:2587)
	at org.eclipse.swt.graphics.Image.getBounds(Image.java:738)
	at org.eclipse.swt.widgets.TableItem.drawImage(TableItem.java:213)
	at org.eclipse.swt.widgets.TableItem.paint(TableItem.java:1122)
	at org.eclipse.swt.widgets.Table.paintSubItem(Table.java:1936)
	at org.eclipse.swt.widgets.Table.paintItems(Table.java:1903)
	at org.eclipse.swt.widgets.Table.paint(Table.java:1834)
	at org.eclipse.swt.widgets.Table.handleEvents(Table.java:1437)
	at
org.eclipse.swt.widgets.SelectableItemWidget$2.handleEvent(SelectableItemWidget.java:1199)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:731)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:752)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:738)
	at org.eclipse.swt.widgets.Composite.XExposure(Composite.java:882)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:906)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3478)
	at org.eclipse.swt.internal.motif.OS.XtDispatchEvent(Native Method)
	at org.eclipse.swt.widgets.Control.update(Control.java:2855)
	at org.eclipse.swt.widgets.Control.update(Control.java:2840)
	at
org.eclipse.swt.widgets.SelectableItemWidget.scroll(SelectableItemWidget.java:1580)
	at org.eclipse.swt.widgets.Table.scrollVerticalRemovedItem(Table.java:2390)
	at
org.eclipse.swt.widgets.SelectableItemWidget.removingItem(SelectableItemWidget.java:1477)
	at org.eclipse.swt.widgets.Table.removeItem(Table.java:2209)
	at org.eclipse.swt.widgets.TableItem.dispose(TableItem.java:179)
	at org.eclipse.swt.widgets.Table.remove(Table.java:2069)
	at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:497)
	at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:449)
	at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:926)
	at
org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:864)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:924)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:883)
	at
org.eclipse.ui.internal.presentations.AbstractTableInformationControl.removeSelectedItems(AbstractTableInformationControl.java:321)
	at
org.eclipse.ui.internal.presentations.AbstractTableInformationControl$1.keyPressed(AbstractTableInformationControl.java:221)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:121)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:731)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:752)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:738)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1794)
	at org.eclipse.swt.widgets.Control.XKeyPress(Control.java:3123)
	at org.eclipse.swt.widgets.Composite.XKeyPress(Composite.java:906)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:908)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3478)
	at org.eclipse.swt.internal.motif.OS.XtDispatchEvent(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2640)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1375)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1346)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:252)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:272)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:128)
	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:324)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:186)
	at org.eclipse.core.launcher.Main.run(Main.java:647)
	at org.eclipse.core.launcher.Main.main(Main.java:631)
Graphic is disposed
Comment 3 Steve Northover CLA 2004-06-22 12:17:20 EDT
You disposed the image behind the back of the Table.  On Windows (and 
elsewhere), you are feeding the operating system garbage, but it recovers.  It 
is also possible that the native tables on the other platforms are not 
painting right away and the case does not happen.

You need to dispose the image after the items have been disposed.  Consult 
with Veronika before applying your fix just to be safe at this late date.
Comment 4 Billy Biggs CLA 2004-06-22 12:25:23 EDT
Created attachment 12659 [details]
Workaround in jface

The table is dynamically created from the part tab list in
BasicStackContentProvider.  Only after the tab is destroyed along with its icon
does the editor drop down get a chance to update.  If a paint occurs, it could
try to reference the disposed icon.

This patch avoids this case by using setRedraw() around the code where we
remove items from the Table to try and avoid paints which occur due to the
scrolling.  We only do this on Motif.  This may be an acceptable workaround for
RC4.
Comment 5 Billy Biggs CLA 2004-06-22 13:45:53 EDT
Created attachment 12672 [details]
New patch which only modifies BasicStackList

This patch to org.eclipse.ui.workbench updates the previous patch by only using
the setRedraw() hack in BasicStackList.  This workaround should be a lot safer
than the old one.
Comment 6 Tod Creasey CLA 2004-06-22 14:12:13 EDT
Patch released for 20040622-1600
Comment 7 Michael Van Meekeren CLA 2004-06-23 16:38:24 EDT
verified by BB on MOTIF