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

Bug 460017

Summary: [GTK2] Entries in combo overwrite each other when set via combo.add(String string, int index)
Product: [Eclipse Project] Platform Reporter: Markus Schorn <mschorn.eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P5 CC: akurtakov, ericwill
Version: 4.4.1Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 530841    
Attachments:
Description Flags
Screenshot of the combo none

Description Markus Schorn CLA 2015-02-16 09:01:09 EST
Created attachment 250829 [details]
Screenshot of the combo

I see the bug on Ubuntu-1404 with
   org.eclipse.swt_3.103.1.v20140903-1938.jar or 
   org.eclipse.swt_3.103.2.v20150203-1313.jar
but not with 
   org.eclipse.swt_3.103.0.v20140605.jar

Adding text to a combo using combo.add(String text, int index) causes a drop down where one entry overwrites the other in the same place. See demonstration code and attached screen shot.

Demo code:
==========

package testSWT;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class TestCombo {
    public static void main(String[] args) {
        final Display disp = Display.getDefault();
        Shell shell = new Shell(disp);
        shell.setLayout(new GridLayout());

        final Combo combo = new Combo(shell, SWT.READ_ONLY | SWT.BORDER);
        combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
        combo.add("first", 0);
        combo.add("second", 1);
        combo.add("third", 1);
        combo.add("fourth", 1);

        shell.setText("Combo Test");
        shell.setSize(200, 200);
        shell.setLocation(0, 0);  
        shell.open();

        while (!shell.isDisposed()) {
            if (!disp.readAndDispatch()) {
                disp.sleep();
            }
        }
    }
}
Comment 1 Leo Ufimtsev CLA 2015-02-17 10:46:52 EST
I can reproduce on latest SWT Master Fedora 21, but only on GTK2.24. On Gtk3 the issue does not occur.
Comment 2 Eric Williams CLA 2016-08-05 09:16:55 EDT
I can reproduce this on GTK2 only, it does not happen on GTK3. GTK2 bugs are low priority at the moment, as we do not have the manpower to dedicate much time to GTK2 only fixes.
Comment 3 Leo Ufimtsev CLA 2018-02-07 10:18:03 EST
Triaging Gtk2-only bugs. Please see Bug 530841 for details.
Comment 4 Eric Williams CLA 2018-07-10 13:57:40 EDT
Please note: GTK2 support for SWT is being dropped in Eclipse 4.10 / SimRel 2018-12 release. 

See the following mail for more info: http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg15783.html
Comment 5 Alexander Kurtakov CLA 2018-07-12 10:16:41 EDT
Marking the bug as wontfix as no work for GTK2 issues will happen. Please reopen if you still face the issue using GTK 3.x.