Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312365 - Carbon: DnD fails when dropping object to a child control.
Summary: Carbon: DnD fails when dropping object to a child control.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.6.1   Edit
Assignee: Silenio Quarti CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-10 22:13 EDT by Hiroyuki Okamoto CLA
Modified: 2010-08-06 12:02 EDT (History)
5 users (show)

See Also:


Attachments
Snippet to reproduce this issue. (2.69 KB, application/octet-stream)
2010-05-10 22:18 EDT, Hiroyuki Okamoto CLA
no flags Details
proposed patch (1.26 KB, text/plain)
2010-05-10 22:18 EDT, Hiroyuki Okamoto CLA
no flags Details
fix (1.43 KB, patch)
2010-05-14 11:59 EDT, Silenio Quarti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroyuki Okamoto CLA 2010-05-10 22:13:48 EDT
Build Identifier: SWT v3646a

DnD fails when dropping object to a child control.
So far, we see this issue on Carbon/Mac OS X. Windows works.

Reproducible: Always

Steps to Reproduce:
1. Create a Composite and setup DropTarget for it.
2. Create a child control in the Composite.
3. Drop an object to the child control.

result: 
the dropped object ignored, and DnD fails.

problem:
The bug is in DropTarget.FindDropTarget().
The bug happens because DropTarget.FindDropTarget() thinks the DnD object dropped to the child control, But, since the child control's getData() returns null, the line "return (DropTarget) widget.getData(DND.DROP_TARGET_KEY);" returns null. It should return correct parent in this case.
Comment 1 Hiroyuki Okamoto CLA 2010-05-10 22:18:03 EDT
Created attachment 167857 [details]
Snippet to reproduce this issue.

Steps to reproduce:
1. Run the snippet - X.java
2. Drag the left label
3. Drop to the right Text control.
4. DropTarget.FindDropTarget() returns null, and fails to drop the obj. (that's the bug.)

Thanks,
Hiro
Comment 2 Hiroyuki Okamoto CLA 2010-05-10 22:18:50 EDT
Created attachment 167858 [details]
proposed patch

Please review this proposed patch.

Thanks,
Hiro
Comment 3 Raji Akella CLA 2010-05-11 11:31:03 EDT
Silenio, can you give us your input on the proposed patch?
Comment 4 Hiroyuki Okamoto CLA 2010-05-14 11:25:01 EDT
Silenio,
could you review the proposed patch at least ?  
Our product needs to fix this issue asap. so if the patch looks ok, our product is going to merge it in our swt asap.

Thanks,
Hiro
Comment 5 Silenio Quarti CLA 2010-05-14 11:59:25 EDT
Created attachment 168556 [details]
fix

Sorry about the delay. We are quite busy with the 3.6 end game.

This should be the fix. Same idea, but it uses OS calls to get parent instead of Control.getParent().
Comment 6 Raji Akella CLA 2010-05-14 12:23:58 EDT
Thanks Silenio.
Comment 7 Hiroyuki Okamoto CLA 2010-05-14 13:46:24 EDT
Thank you Silenio!
We will test the fix with our product and let you know the result.

Thanks,
Hiro
Comment 8 Hiroyuki Okamoto CLA 2010-05-14 13:52:24 EDT
We verified the fix works with our product.  Thanks!
Comment 9 Raji Akella CLA 2010-08-05 19:31:50 EDT
Silenio, can you include this in 3.6.1?
Comment 10 Silenio Quarti CLA 2010-08-06 12:02:59 EDT
Fix has been release to R3_6_maintenance and HEAD.