Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 363625

Summary: non-root-level items become corrupted when TreeColumn disposed
Product: [Eclipse Project] Platform Reporter: Grant Gayed <grant_gayed>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, lshanmug, Silenio_Quarti
Version: 4.2   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Grant Gayed CLA 2011-11-11 16:45:08 EST
- run the snippet below
- notice that all items identify their row and column indices
- after 5s the second column is disposed
- look at the resulting items in the second column
   -> the root-level items look fine (they all end in "column 2")
   -> however their child items are all wrong (they all end in "column 1")

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    final Tree tree = new Tree(shell, SWT.NONE);
    tree.setHeaderVisible(true);
    new TreeColumn(tree, SWT.NONE).setWidth(200);
    new TreeColumn(tree, SWT.NONE).setWidth(200);
    new TreeColumn(tree, SWT.NONE).setWidth(200);
    for (int i = 0; i < 9; i++) {
    	TreeItem root = new TreeItem(tree, SWT.NONE);
    	TreeItem item = new TreeItem(root, SWT.NONE);
    	for (int j = 0; j < 3; j++) {
    		root.setText(j, "root item " + i + " column " + j);
    		item.setText(j, "item " + i + " column " + j);
    	}
    	root.setExpanded(true);
    }
	display.timerExec(5000, new Runnable() {	
		public void run() {
			tree.getColumn(1).dispose();
		}
	});
	shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
    	if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
}
Comment 1 Lars Vogel CLA 2019-11-14 03:13:16 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.