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

Bug 385732

Summary: Combo's removeAll why call postEvent?
Product: [Eclipse Project] Platform Reporter: Levente Farkas <lfarkas>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ericwill
Version: 4.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Levente Farkas CLA 2012-07-23 09:40:25 EDT
Build Identifier: 3.6.1-6.13.el6.x86_64 

in Combo's removeAll call clearText which is :
----------------------------------
void clearText () {
    OS.g_signal_handlers_block_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
    if ((style & SWT.READ_ONLY) != 0) {
        int index = OS.gtk_combo_box_get_active (handle);
        if (index != -1) {
            int /*long*/ modelHandle = OS.gtk_combo_box_get_model (handle);
            int /*long*/ [] ptr = new int /*long*/ [1];
            int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
            OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, index);
            OS.gtk_tree_model_get (modelHandle, iter, 0, ptr, -1);
            OS.g_free (iter);
            if (ptr [0] != 0 && OS.strlen (ptr [0]) > 0) postEvent (SWT.Modify);
            OS.g_free (ptr [0]);
        }
    } else {
        OS.gtk_entry_set_text (entryHandle, new byte[1]);
    }
    OS.gtk_combo_box_set_active (handle, -1);
    OS.g_signal_handlers_unblock_matched (handle, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
----------------------------------
why it's called postEvent and why just in case of SWT.READ_ONLY case? it doesn't make any sence if called from removeAll.

Reproducible: Always
Comment 1 Eric Williams CLA 2018-05-14 14:50:35 EDT
Is there a bug here, or is this just a question about implementation details?
Comment 2 Levente Farkas CLA 2018-05-14 17:00:40 EDT
we assume it's a bug that's way i wrote this entry.
Comment 3 Eric Williams CLA 2018-05-15 11:58:52 EDT
(In reply to Levente Farkas from comment #2)
> we assume it's a bug that's way i wrote this entry.

Okay. I looked into the code, and I can't see anything explaining why it's set up that way. Do you have a snippet that reproduces the bug which this causes?
Comment 4 Levente Farkas CLA 2018-05-16 04:25:20 EDT
this is our old test code:
https://pastebin.com/6vwP471U
Comment 5 Eric Williams CLA 2018-05-16 10:24:09 EDT
(In reply to Levente Farkas from comment #4)
> this is our old test code:
> https://pastebin.com/6vwP471U

Thanks for the snippet. This is the output I get when running it:

ADD: Central 1 (40/40)
after
Central 1 (40/40)
ADD: Central 2 (40/40)
after
Central 2 (40/40)
Central 1 (40/40)
ADD: Central 10 (40/40)
after
Central 2 (40/40)
Central 10 (40/40)
Central 1 (40/40)
ADD: Central 3 (40/40)
after
Central 3 (40/40)
Central 2 (40/40)
Central 10 (40/40)
Central 1 (40/40)
ADD: Central 11 (40/40)
after
Central 3 (40/40)
Central 2 (40/40)
Central 11 (40/40)
Central 10 (40/40)
Central 1 (40/40)
ADD: Central 4 (40/40)
after
Central 4 (40/40)
Central 3 (40/40)
Central 2 (40/40)
Central 11 (40/40)
Central 10 (40/40)
Central 1 (40/40)
ADD: Central 12 (40/40)
after
Central 4 (40/40)
Central 3 (40/40)
Central 2 (40/40)
Central 12 (40/40)
Central 11 (40/40)
Central 10 (40/40)
Central 1 (40/40)


What exactly is the bug?
Comment 6 Levente Farkas CLA 2018-05-17 06:00:21 EDT
in the current swt it's working. it a bug report from 2012