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

Bug 315326

Summary: SIGSEGV in _G_OBJECT_TYPE during moveAbove
Product: [Eclipse Project] Platform Reporter: Alex Bradley <a.bradley>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: bokowski, john.arthorne, pinnamur
Version: 3.6Flags: bokowski: review+
john.arthorne: review+
Target Milestone: 3.6 RC4   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test case that demonstrates the bug.
none
Sample JVM crash report.
none
Patch
none
final patch none

Description Alex Bradley CLA 2010-06-01 19:50:49 EDT
Build Identifier: I20100520-1744

Using moveAbove to move a Label in a Composite after a Label from that Composite has previously been disposed results in a segfault in the circumstances described in "Steps to Reproduce".

The test case works fine with Eclipse 3.5.1 (M20090917-0800), SWT jarfile org.eclipse.swt.gtk.linux.x86.source_3.5.1.v3555a.jar. It crashes with 3.6RC2 (SWT jarfile org.eclipse.swt.gtk.linux.x86.source_3.6.0.v3649.jar).

Reproducible: Always

Steps to Reproduce:
1. Run attached test case.
2. Click "Crash Me".

Or,

1. Add a Label widget and then a Text widget to a Composite.
2. Dispose the Label.
3. Add a new Label widget to the Composite and use moveAbove to move it above the Text widget.
Comment 1 Alex Bradley CLA 2010-06-01 19:52:35 EDT
Created attachment 170726 [details]
Test case that demonstrates the bug.
Comment 2 Alex Bradley CLA 2010-06-01 19:54:51 EDT
Created attachment 170727 [details]
Sample JVM crash report.
Comment 3 Praveen CLA 2010-06-02 01:20:20 EDT
Created attachment 170740 [details]
Patch

This is bad. SWT is incorrectly trying to get the accesibility for the disposed label, due to which native crash is seen. The fix is to make sure SWT does not remove relation when the label control is disposed.
Silenio, I believe this is an important fix that should be released. Please review and post your comments.
Comment 4 Silenio Quarti CLA 2010-06-02 10:57:41 EDT
Created attachment 170810 [details]
final patch

The patch above avoided the crash but left a relation to the disposed control.

This patch removes the relation before the widget is disposed.
Comment 5 Silenio Quarti CLA 2010-06-02 11:00:56 EDT
Boris/John please review this for RC4.
Comment 6 John Arthorne CLA 2010-06-02 11:35:23 EDT
Reviewed together with Silenio. We think there might be a similar bug in the Cocoa code, but we'll treat it separately because it might not cause a crash.
Comment 7 Boris Bokowski CLA 2010-06-02 11:42:43 EDT
Based on review with Silenio and John.
Comment 8 Silenio Quarti CLA 2010-06-02 11:56:21 EDT
I confirmed that cocoa/carbon (which have similar code in Control.release(boolean) do not crash with this test case. The difference is that, in cocoa/carbon, the control does not have a reference to the label. 

I will open a bug to considered making similar changes in cocoa/carbon post 3.6.
Comment 9 Silenio Quarti CLA 2010-06-02 12:04:50 EDT
Fixed > 20100602