Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318830 - Text.setText fails during FocusOut event listener (SWT.SINGLE, and when followed by access to the Text)
Summary: Text.setText fails during FocusOut event listener (SWT.SINGLE, and when follo...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Scott Kovatch CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
: 324056 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-04 22:29 EDT by Doug M CLA
Modified: 2010-09-15 16:58 EDT (History)
2 users (show)

See Also:


Attachments
Demonstrates bug. See steps to reproduce. (2.04 KB, application/octet-stream)
2010-07-04 22:33 EDT, Doug M CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug M CLA 2010-07-04 22:29:57 EDT
Build Identifier: swt-I20100608-0911-cocoa-macosx-x86_64

When setText is done in a FocusOut event listener, it sometimes fails to change the Text. This happens when setText is followed by getCharCount, computeSize, getText, and possibly any method that accesses the Text content. 

If the FocusOut event is caused by switching to a different application (rather than to a different widget), setText works. If setText is NOT followed by another Text method, it works.

I have traced setText and getText down to NSCell.setTitle(NSString) and NSCell.title(). The NSCell is the same in both calls. However, when setText fails, the NSString returned by title() is the unchanged value, not the value just set with setTitle(string).

Sample snippet contains two Texts. On FocusIn the first Text is set to "Hello"; on FocusOut to "Goodbye". Clicking to the second Text demonstrates that setText fails to change the area's content. Commenting out subsequent access to the Text, or losing focus by app switch shows the that setText succeeds in changing the content.

I am rating as a major bug because it prevents implementing an auto-complete text field that is essential to our project.

Reproducible: Always

Steps to Reproduce:
1. Run the example.
2. See that clicking to the second Text does not change the first one, but switching apps does.
3. Remove call to getCharCount() in the FocusOut listener.
4. See that setText now succeeds in both situations.
Comment 1 Doug M CLA 2010-07-04 22:33:23 EDT
Created attachment 173387 [details]
Demonstrates bug. See steps to reproduce.
Comment 2 Scott Kovatch CLA 2010-07-06 13:11:14 EDT
That's a good bug -- I'll see what I can do for 3.6.1.
Comment 3 Scott Kovatch CLA 2010-09-01 14:22:12 EDT
*** Bug 324056 has been marked as a duplicate of this bug. ***
Comment 4 Scott Kovatch CLA 2010-09-01 17:57:44 EDT
Looks like I can fix this by setting the string into the fieldEditor if one is returned. Looks like multiple Verify events aren't being sent so it looks good.
Comment 5 Scott Kovatch CLA 2010-09-01 18:27:04 EDT
Fixed > 20100901.