Community
Participate
Working Groups
If a listener removes itself and re-adds itself during an event callback, sometimes it will receive an additional notification. Specifically, in the presence of other listeners, it gets duplicate notification. If it is the sole listener, it only gets notified once. The following snippet demonstrates the problem. If two listeners are used, there is an infinite loop. public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); final Text text = new Text(shell, SWT.NONE); text.setBounds(10, 10, 90, 30); text.setText("blah"); class Hooked implements ModifyListener { public void modifyText(ModifyEvent e) { text.removeModifyListener(this); text.addModifyListener(this); } }; // text.addModifyListener(new Hooked()); text.addModifyListener(new Hooked()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
Silenio, was this fixed by your new compression technique?
No.
(In reply to comment #2) > No. In addition, the AbstractCombo.removeModifyListener(ModifyListener) method. line 2 reads: if(text != null) text.addModifyListener(listener); I guess this should be: if(text != null) text.removeModifyListener(listener); Fixing this, didn't solve the above problem, however. Using the untyped listener with SWT.modify reproduced the same behavior as outlined in the original description.
AbstractCombo is not an SWT class. Does it belong to GEF?
Maybe he meant CCombo?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.