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

Bug 245593

Summary: Disposing a widgets parent during event processing like focusLost is causing a gpf
Product: [Eclipse Project] Platform Reporter: Philipp Simon <philipp_simon>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, ipun, melickm, Silenio_Quarti
Version: 4.7Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
snippet showing the problem + snippet showing the workaround + gpf data
none
Snippet reproducing the focus issue none

Description Philipp Simon CLA 2008-08-28 18:00:23 EDT
We are encountering a gpf when disposing of the parent of a widget during a focusLost() or keyDown() event attached to the widget when trying to click on a new widget after that event got triggered. The workaround for this is to run the disposal code via Display.asyncExec(). So its always executed after the processing of the focusLost event. It happens on gtk 2.2.x 2.6.x 2.8.x and SWT 3.2 and 3.4.1. It seems like the dispose does not function correct when called under that circumstance or the container messses up references. I have attached a short example snippet ( with a short doc how to reproduce the gpf), example dump/javacore and a snippet with the workaround for this. This just happens on linux-gtk and works fine on winxp platforms. Please add a remark if this is related to a gtk problem and not a swt one so we can try to get fast help via Linux support.

Thanks,
Philipp
Comment 1 Philipp Simon CLA 2008-08-28 19:08:32 EDT
Created attachment 111253 [details]
snippet showing the problem + snippet showing the workaround + gpf data

Adding the attachment failed the first time. Trying a second time.
Comment 2 Silenio Quarti CLA 2008-10-29 10:43:14 EDT
Bogdan, could you investigate this one?
Comment 3 Bogdan Gheorghe CLA 2008-10-29 13:22:24 EDT
I can reproduce this on versions of GTK equal or less than 2.8.x. For versions greater than 2.8.x it doesn't GP. Can you verify this on your system?
Comment 4 Philipp Simon CLA 2008-10-30 12:48:39 EDT
Hi Bogdan,

i will try to verify this asap, but since i have to get some sort of vm image or set up a machine with a higher gtk version it might take some time.

Thanks so far,

Philipp
Comment 5 Eric Williams CLA 2016-10-04 11:01:31 EDT
Created attachment 264574 [details]
Snippet reproducing the focus issue

I can't reproduce the crash, *however* I can reproduce the focus issue.

Running the snippet attached and clicking between the two text boxes causes the focus to be lost in between them. If you click a second time the focus returns.
Comment 6 Eric Williams CLA 2016-10-04 11:05:34 EDT
Adjusting priority as well, since this doesn't cause a crash anymore.
Comment 7 Eric Williams CLA 2019-02-21 15:39:51 EST
After looking at this closer I do not think it's reasonable to fix this issue. Strictly speaking, the original widgets that had focus were disposed, so it's not really a bug that they don't have focus again when being recreated.

Since the crash is no longer happening I am marking this as WORKSFORME.