Bug 204333 - Display.post(Event) hangs on GTK
Summary: Display.post(Event) hangs on GTK
Status: RESOLVED DUPLICATE of bug 247069
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux-GTK
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-21 17:19 EDT by Gary Johnston CLA
Modified: 2008-12-22 12:55 EST (History)
6 users (show)

See Also:


Attachments
Stack traces showing deadlock (2.87 KB, text/plain)
2008-05-13 21:15 EDT, Gary Johnston CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Johnston CLA 2007-09-21 17:19:39 EDT
Build ID: I20070625-1500

Steps To Reproduce:
I'm trying to make some test automation code perform a drag & drop.  I'm using Display.post(Event event) to send user input events.  Following is an outline of how I do DnD.  Note that this is running on a separate thread (i.e., not on the UI/display thread).  Display.post(Event) doesn't require being on the display thread.

1. Post a MouseMove event to move the cursor to the location of the drag
   source.
2. Post a MouseDown (button 1) event.
3. Post a series of MouseMove events that move the cursor 
   one pixel at a time in order to trigger drag detect.
4. Post a MouseMove event to move the cursor to the location
   of the drop target.
5. Post a MouseUp (button 1) event.

On Windows this works for me.  But on GTK it hangs in Display.post(Event) in the call to OS.GDK_DISPLAY() when it tries to post the first MouseMove event in step 3 (i.e., trying to post the first MouseMove after posting the MouseDown).

More information:
If I set a breakpoint and suspend the whole VM just before the problematic MouseMove attempt I find that the display thread is sleeping in a read/dispatch loop within its windowproc.  It looks like it is waiting for user input events to cause drag detect (or not).  I also find that if I try to step my own thread through its MouseMove call to Display.post(Event) it gets blocked in the call to OS.GDK_DISPLAY(). Resuming the display thread doesn't unblock it.

So it looks like an unavoidable deadlock situation.  I cannot see a way to post the necessary user input events without getting this deadlock.
Comment 1 Gary Johnston CLA 2007-10-03 09:02:26 EDT
Just wondering if anyone has had a chance to look into this one at all yet?  I'd be interested in a workaround for now, and at least a prognosis for a fix (assuming it really is a bug).  Thanks.
Comment 2 Bogdan Gheorghe CLA 2007-10-08 23:20:36 EDT
I was able to reproduce this. Investigating...
Comment 3 Tod Creasey CLA 2007-10-31 13:17:07 EDT
What is the status of this?
Comment 4 Gary Johnston CLA 2008-05-13 13:09:21 EDT
Request status update.  Anyone looked into this one?
Comment 5 Gary Johnston CLA 2008-05-13 21:15:17 EDT
Created attachment 100092 [details]
Stack traces showing deadlock

Here is an attachment that shows a relevant deadlock situation.  This is with Eclipse 3.4M7.
Comment 6 Bogdan Gheorghe CLA 2008-05-15 14:03:11 EDT
Can you attach the exact snippet you are using? Thanks.
Comment 7 Bogdan Gheorghe CLA 2008-12-22 12:55:15 EST
I believe this is a duplicate of 247069. Please try out the latest M5-stream milestone and reopen if this bug still appears for you. Thanks!

*** This bug has been marked as a duplicate of bug 247069 ***