Bug 85862 - [consistency] TreeEvent fired upon disposal of TreeItems
Summary: [consistency] TreeEvent fired upon disposal of TreeItems
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: consistency
Depends on:
Blocks:
 
Reported: 2005-02-18 14:35 EST by Benjamin Pasero CLA
Modified: 2005-04-26 12:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Pasero CLA 2005-02-18 14:35:12 EST
Either calling dispose() on a TreeItem or removeAll() on the Tree results in
TreeEvents being fired. That happens in case the disposed TreeItem was expanded
and contained children. Mac seems to collapse all expanded TreeItems at first
before proceeding with the disposal.

This is not happening on Windows, and I dont think its happening on Linux GTK or
Solaris Motif either.

Ben
Comment 1 Steve Northover CLA 2005-02-18 14:48:37 EST
GG to construct a simple example and/or demonstate the difference in the 
ControlExample, then fix with SN.
Comment 2 Grant Gayed CLA 2005-04-05 11:46:27 EDT
click on the Tree in the snippet to dispose its root item:

public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setBounds(10,10,200,200);
	Tree tree = new Tree(shell, SWT.NONE);
	tree.setBounds(10,10,100,100);
	final TreeItem root = new TreeItem(tree, SWT.NONE);
	root.setText("root");
	TreeItem child = new TreeItem(root, SWT.NONE);
	child.setText("child");
	tree.addTreeListener(new TreeAdapter() {
		public void treeCollapsed(TreeEvent e) {
			System.out.println("collapsed");
		}
	});
	tree.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			root.dispose();
		}
	});
	root.setExpanded(true);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
Comment 3 Silenio Quarti CLA 2005-04-26 12:41:15 EDT
fixed > 0426, but note that this will NOT be in this week's integration build