Bug 24273 - GP -Tree removeAll reboot windowsXp
Summary: GP -Tree removeAll reboot windowsXp
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Christophe Cornu CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-10-01 12:14 EDT by Felipe Heidrich CLA
Modified: 2002-12-11 11:50 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felipe Heidrich CLA 2002-10-01 12:14:42 EDT
build 20020924
ensure you are using common-control 6.0


- Run the test case.
- Click in the test button, it will insert 350 items on Tree
- Click in the test button again, it will call removeAll for the Tree
- the removeall process is very slow, and eventually it will cause windows to 
reboot.


Testcase:
	public static void main (String [] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		shell.setLayout(new FillLayout());
		
		final Tree tree = new Tree (shell, SWT.BORDER | 
SWT.FULL_SELECTION);
		Button button = new Button (shell, SWT.PUSH);
		button.setText("Test");
		button.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event event) {
				if (tree.getItemCount() == 0) {
					for (int i =0; i< 350; i++) {
						TreeItem item = new TreeItem 
(tree, 0);
						item.setText("Text " + i);
					}
				} else {
					tree.removeAll();
				}
			}
		});		
		
		shell.open ();
		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ())
				display.sleep ();
		}
		
		display.dispose ();
	}
Comment 1 Steve Northover CLA 2002-10-31 13:52:04 EST
Reproduced on 2 different XP boxes.
Manifest not required (thus it is not related to commctrl 6.0)
Only reproduced with the 'Window Classic' theme.

Note that tree.removeAll is unacceptably slow.
It is due to that line in Tree.removeAll:
int result = OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, OS.TVI_ROOT);
The crash also occurs while the OS is processing this message.
Found reports that post commctr 4.72, this call can be slow unless redrawing is 
disabled.

Current workaround: disable redraw prior to removing all items
tree.setRedraw(false);
tree.removeAll();
tree.setRedraw(true);
Comment 2 Steve Northover CLA 2002-11-01 14:16:08 EST
Fixed in version >v2114