Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315326 - SIGSEGV in _G_OBJECT_TYPE during moveAbove
Summary: SIGSEGV in _G_OBJECT_TYPE during moveAbove
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.6 RC4   Edit
Assignee: Silenio Quarti CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-01 19:50 EDT by Alex Bradley CLA
Modified: 2010-06-02 12:04 EDT (History)
3 users (show)

See Also:
bokowski: review+
john.arthorne: review+


Attachments
Test case that demonstrates the bug. (1.29 KB, text/x-java)
2010-06-01 19:52 EDT, Alex Bradley CLA
no flags Details
Sample JVM crash report. (35.42 KB, text/x-log)
2010-06-01 19:54 EDT, Alex Bradley CLA
no flags Details
Patch (842 bytes, patch)
2010-06-02 01:20 EDT, Praveen CLA
no flags Details | Diff
final patch (1.02 KB, patch)
2010-06-02 10:57 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 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