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

Bug 323943

Summary: [SWT/Carbon]When Combo dispose, Eclipse display UI Error.
Product: [Eclipse Project] Platform Reporter: alf <lihedl>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, lihedl, linyunz, mukund, ob1.eclipse, pwebster, raji, remy.suen, Silenio_Quarti
Version: 3.4.2Flags: eclipse.felipe: review+
Target Milestone: 3.7 M2   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
reproduct bug plugin
none
CN test as a workspace project
none
Screenshot
none
patch for HEAD
none
patch for HEAD
none
new bug plugin
none
new bug Screenshot
none
second patch
none
Patch for 3.6.2 none

Description alf CLA 2010-08-30 05:41:55 EDT
Build Identifier: 3.4.2

You display a combo in eclispe view, and if you close the view, the text content in combo will be displayed in top-left corner of eclipse workbanch.
Notes: For reproduct this bug, you must satisfy following two condition:
1  combo can't catch focus.
2   the beginning of the text in Combo is truncated.

Reproducible: Always

Steps to Reproduce:
1.  put the plugin into your eclispe drop folder
2.  lauch eclipse, and open view named "Alf" in "Sample Categroy" by "Show View" dialog.    
Window--->Show View--->Others...--->"Sample Categroy"--->Alf
3.  close the "alf" view by click "x".
4.  please see top-left corner of eclipse workbanch.
Comment 1 alf CLA 2010-08-30 05:46:52 EDT
Created attachment 177710 [details]
reproduct bug plugin

You can import into eclispe to observe source code. Or you put plugin into eclispe drop folder to reproduct this bug.
Comment 2 alf CLA 2010-08-30 05:48:44 EDT
Notes: For reproduct this bug, you must satisfy following two condition:
1  combo can't catch focus.
2   the beginning of the text in Combo is truncated.
Comment 3 Remy Suen CLA 2010-08-30 07:01:10 EDT
So this is only a problem on Macs with the Carbon build? It cannot be reproduced on other platforms? Is there a problem on 3.6 with Cocoa?
Comment 4 Paul Webster CLA 2010-08-30 12:11:23 EDT
Created attachment 177747 [details]
CN test as a workspace project

Oleg, could you please try the test with this project on your mac in 3.6 and 3.4.2 and see if you can reproduce it?

PW
Comment 5 Oleg Besedin CLA 2010-08-30 14:07:58 EDT
Using Eclipse 3.6 I can reproduce it on Carbon; it works fine on Cocoa 32bit. Seems like a painting issue.
Comment 6 Felipe Heidrich CLA 2010-08-30 15:52:36 EDT
works for me on snow leopard running eclipse 3.7
I'll try on the leopard now,

can anyone post a screenshot of the problem ? I'm not sure what I'm looking for on the top left corner.
Comment 7 Oleg Besedin CLA 2010-08-30 16:13:09 EDT
Created attachment 177780 [details]
Screenshot

This is using Eclipse SDK 3.6 / Carbon, on Mac OS X 10.5.8 (Leopard, I believe.)
Comment 8 Felipe Heidrich CLA 2010-08-30 16:32:25 EDT
I can see the problem on 1.5.8
Comment 9 Felipe Heidrich CLA 2010-08-30 16:32:54 EDT
(In reply to comment #8)
> I can see the problem on 1.5.8

I mean 10.5.8 (leopard)
Comment 10 Felipe Heidrich CLA 2010-08-30 17:25:15 EDT
Simple SWT snippet that reproduces the problem:

import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.*;


public class PR323943 {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout(SWT.VERTICAL));
	
	
	Composite comp = new Composite(shell, SWT.NONE);

	final Composite comp1 = new Composite(shell, SWT.NONE);
	comp.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			comp1.dispose();
		}
	});
	comp1.setLayout(new FillLayout());
	Text text = new Text(comp1, 0);
	text.setText("Textlength Textlength Textlength Textlength Textlength ");
	Combo combo = new Combo(comp1, SWT.DROP_DOWN);
	combo.add("AI Bayan");
	combo.add("Combolength Combolength Combolength Combolength Combolength Combolength Combolength Combolength Combolength Combolength Combolength");
	combo.select(1);

	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 11 Silenio Quarti CLA 2010-08-31 10:11:36 EDT
The comment above was done by me.
Comment 12 Silenio Quarti CLA 2010-08-31 10:12:04 EDT
Created attachment 177839 [details]
patch for HEAD
Comment 13 Silenio Quarti CLA 2010-08-31 10:16:18 EDT
Created attachment 177841 [details]
patch for HEAD

Forgot to add a style (SWT.DROP_DOWN) check in the previous patch.
Comment 14 Silenio Quarti CLA 2010-08-31 10:31:41 EDT
Fixed > 20100831.
Comment 15 alf CLA 2010-09-09 03:17:30 EDT
Hi! This bug fix import another new bug. 
When open view with an empty Combo, the new bug will produce.

Steps to Reproduce:
1  Download my "new bug plugin" source code into workspace. 
2  Lauch eclipse, and open view named "Alf" in "Sample Categroy" by "Show
View" dialog.    
Window--->Show View--->Others...--->"Sample Categroy"--->Alf
3.  close the "alf" view by click "x".
4.  please see top-left corner of eclipse workbanch.

A screenshot of the problem please refer to "new bug Screenshot" attachment.
Comment 16 alf CLA 2010-09-09 03:19:23 EDT
Created attachment 178486 [details]
new bug plugin
Comment 17 alf CLA 2010-09-09 03:20:15 EDT
Created attachment 178487 [details]
new bug Screenshot
Comment 18 Bogdan Gheorghe CLA 2010-09-13 10:24:10 EDT
Created attachment 178743 [details]
second patch

I am not able to reproduce this new problem (not sure what step I am missing). Please could you try this new patch and see if both problems are fixed for you? This patch fixes the first problem in a simpler and more reliable way. I suspect it will fix the second problem as well.

Note that the second patch has to applied on top of the first patch.
Comment 19 Silenio Quarti CLA 2010-09-13 10:24:59 EDT
The comment above was done by me.
Comment 20 alf CLA 2010-09-14 03:22:59 EDT
Cool.....
The bug fixed.  you are great. 
Thanks for your time.
Comment 21 Raji Akella CLA 2010-09-14 15:40:29 EDT
Nice! Are you going to bring this fix into 3.6.2?
Comment 22 Silenio Quarti CLA 2010-09-15 10:06:11 EDT
Created attachment 178932 [details]
Patch for 3.6.2

Yes, this is the patch for 3.6.2
Comment 23 Silenio Quarti CLA 2010-09-15 10:06:38 EDT
Felipe, please review for 3.6.2
Comment 24 Silenio Quarti CLA 2010-09-15 10:12:09 EDT
Fixed in HEAD (>20100915) and R3_6_maintenance. Note that this fix will not be in 3.7 M2.
Comment 25 mukundan desikan CLA 2011-01-11 18:09:01 EST
So is this fixed in SWT 3.6.2 ?
Comment 26 Silenio Quarti CLA 2011-01-12 09:28:10 EST
(In reply to comment #25)
> So is this fixed in SWT 3.6.2 ?

yes