Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 226973 - On Linux, TableColumn#getWidth() sometimes incorrectly returns 0.
Summary: On Linux, TableColumn#getWidth() sometimes incorrectly returns 0.
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 180262
  Show dependency tree
 
Reported: 2008-04-14 13:04 EDT by Paul Slauenwhite CLA
Modified: 2009-06-19 14:37 EDT (History)
2 users (show)

See Also:


Attachments
TableTest.java (2.57 KB, text/x-java)
2008-04-14 13:04 EDT, Paul Slauenwhite CLA
no flags Details
Proposed patch (1019 bytes, patch)
2009-03-20 07:33 EDT, Praveen CLA
no flags Details | Diff
Test case (2.85 KB, text/plain)
2009-03-20 07:48 EDT, Praveen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2008-04-14 13:04:19 EDT
On Linux, TableColumn#getWidth() sometimes incorrectly returns 0.

OS*:
Linux paules 2.6.16.53-0.16-smp #1 SMP Tue Oct 2 16:57:49 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux

*Note, running in 32-bit compatibility mode.  However, symptoms are reproducible on 32-bit architectures.

Eclipse SDK:
Version: 3.4.0
Build id: I20080330-1350

JRE:
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pxi32dev-20070201 (SR4))IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20070201 (JIT enabled)
J9VM - 20070131_11312_lHdSMR
JIT  - 20070109_1805ifx1_r8
GC   - 200701_09)
JCL  - 20070126

Steps to reproduce:

1) Run the enclosed TableTest.java.
2) Click the Add button.
3) Select Tab2.
4) Select Tab1.
5) Click the Add button.
4) Note the following output:

Column1 width: 100

Column1 width: 100
Column2 width: 100

Column1 width: 100
Column2 width: 100

Column1 width: 0
Column2 width: 0
Column3 width: 100

The first two columns return a zero width.
Comment 1 Paul Slauenwhite CLA 2008-04-14 13:04:58 EDT
Created attachment 95945 [details]
TableTest.java
Comment 2 Bogdan Gheorghe CLA 2008-12-22 13:41:43 EST
Praveen to investigate.
Comment 3 Paul Slauenwhite CLA 2009-03-17 08:22:20 EDT
Is there any update on this defect?
Comment 4 Praveen CLA 2009-03-18 08:03:59 EDT
We are working on this right now. When a new column is added to the Table, correct width values will be retrieved only after the size allocation happens. However, in the specified scenario, when the TabItem is switched after pressing ADD button, size allocation does not occur and hence values for table column are incorrectly returned by GTK. We are working for determining the solution for this problem and we will get back to you then. Thanks.
Comment 5 Praveen CLA 2009-03-20 07:33:42 EDT
Created attachment 129444 [details]
Proposed patch

If a new table column is added when the table is not visible, then the table is not allocated/resized immediately. Due to this, querying the width at this time results in incorrect value from GTK. Code had been modified to make sure that the table columns are always resized (when the table is invisible) after a new table column is added.
I have unit tested the code changes with the provided sample.
Bogdan, please suggest if I miss anything in the code change. Thanks !
Comment 6 Praveen CLA 2009-03-20 07:48:44 EDT
Created attachment 129446 [details]
Test case

Test case (slightly modified from the attached snippet) for testing the code changes. Add/Display buttons are added to add the table column when the table is visible. This proves that currently(with code change) there is no difference if a table column is added when the table is visible or invisible.
Table is hooked up with the Resize event to make sure whether they are caught at the right time. I verified they are working fine with the new code changes.
Comment 7 Bogdan Gheorghe CLA 2009-03-31 12:39:50 EDT
Patch released to HEAD. Thanks!

Fixed in HEAD > 20090331
Comment 8 Paul Slauenwhite CLA 2009-06-19 14:37:10 EDT
Verified in TPTP-4.6.0RC5-200906160940.

Closing.