Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 187189 - [ViewMgmt] TreeViewer disposes of widget when the third item in the tree is deleted
Summary: [ViewMgmt] TreeViewer disposes of widget when the third item in the tree is d...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 02:55 EDT by Greg Babcock CLA
Modified: 2007-05-18 12:10 EDT (History)
2 users (show)

See Also:


Attachments
Sample code to reproduce bug (7.38 KB, application/octet-stream)
2007-05-16 02:56 EDT, Greg Babcock CLA
no flags Details
Fix for Problem (2.40 KB, patch)
2007-05-16 18:59 EDT, 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 Greg Babcock CLA 2007-05-16 02:55:04 EDT
Build ID: 3.3.0M7

Steps To Reproduce:
1.Run attached sample code
2.Use button to delete tree items from bottom until exception is thrown.
3.


More information:
M6 does not exhibit this behavior.

Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:3547)
	at org.eclipse.swt.SWT.error(SWT.java:3465)
	at org.eclipse.swt.SWT.error(SWT.java:3436)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:432)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:325)
	at org.eclipse.swt.widgets.TreeItem.getBounds(TreeItem.java:401)
	at org.eclipse.jface.viewers.TreeViewerRow.getBounds(TreeViewerRow.java:48)
	at org.eclipse.jface.viewers.ViewerCell.getBounds(ViewerCell.java:83)
	at org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter.focusCellChanged(FocusCellOwnerDrawHighlighter.java:147)
	at org.eclipse.jface.viewers.SWTFocusCellManager.setFocusCell(SWTFocusCellManager.java:151)
	at org.eclipse.jface.viewers.SWTFocusCellManager.handleSelection(SWTFocusCellManager.java:101)
	at org.eclipse.jface.viewers.SWTFocusCellManager.access$2(SWTFocusCellManager.java:92)
	at org.eclipse.jface.viewers.SWTFocusCellManager$1.handleEvent(SWTFocusCellManager.java:126)
Comment 1 Greg Babcock CLA 2007-05-16 02:56:26 EDT
Created attachment 67355 [details]
Sample code to reproduce bug
Comment 2 Greg Babcock CLA 2007-05-16 03:37:40 EDT
My editor application contains table with typically just a couple of items.  Whenever an item is deleted in M7 a Widget disposed exception is thrown.  3.2 and 3.3M6 do not have this problem.
Comment 3 Thomas Schindl CLA 2007-05-16 06:44:22 EDT
Ok. There are multiple problems I forgot to check:
- a "null" check if there hasn't oldCell is null
- a dispose check if the item is removed but old cell is still there
  (I think the main problem is that if the current item is removed the current 
   focus cell should be set to null. I need to investigate how we can detect this 
   situation adding a disposeListener might be the solution but I we need to 
   discuss, Boris?)
Comment 4 Thomas Schindl CLA 2007-05-16 07:24:44 EDT
Hm. I can't reproduce the the NPE now although I'm fairly sure I saw one before. The dispose Exception needs investigation as said above.
Comment 5 Boris Bokowski CLA 2007-05-16 15:14:23 EDT
Tom, are you looking into this?
Comment 6 Thomas Schindl CLA 2007-05-16 18:29:54 EDT
(In reply to comment #5)
> Tom, are you looking into this?
> 

yes. I just started.
Comment 7 Thomas Schindl CLA 2007-05-16 18:59:11 EDT
Created attachment 67555 [details]
Fix for Problem
Comment 8 Boris Bokowski CLA 2007-05-16 21:20:16 EDT
+1 for RC1. Released >20070516.
Comment 9 Boris Bokowski CLA 2007-05-16 21:22:14 EDT
marking as fixed...
Comment 10 Boris Bokowski CLA 2007-05-18 10:41:38 EDT
When running the snippet, the cell editor stays around after deleting for the second time. Tom, is this a separate bug?
Comment 11 Thomas Schindl CLA 2007-05-18 10:46:53 EDT
This is a seperate one but I can't remember having filed one. I'd day that we have this problem everywhere. We need to cancle-Editors before refreshing.
Comment 12 Thomas Schindl CLA 2007-05-18 11:11:40 EDT
problem tracked in bug #187826
Comment 13 Boris Bokowski CLA 2007-05-18 12:10:57 EDT
Verified the is disposed bug using I20070517-1700 on Windows XP.