Community
Participate
Working Groups
Created attachment 181217 [details] java core Using java version "1.6.0" Java(TM) SE Runtime Environment (build pxi3260sr8-20100409_01(SR8)) I bring up our 4.1 SDK, and switch from the Breakpoints view to the Variables view and I get the attached core dump. I haven't yet found a workaround. PW
This is using: org.eclipse.swt_3.7.0.v3710.jar org.eclipse.swt.gtk.linux.x86_3.7.0.v3710.jar PW
Here is the code: boolean setFocus () { if ((style & SWT.SEPARATOR) != 0) return false; if (!OS.gtk_widget_get_child_visible (handle)) return false; OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); OS.gtk_widget_grab_focus (handle); boolean result = OS.gtk_widget_is_focus (handle); if (!result) OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS); return result; } I'm suppose application code is running when gtk_widget_grab_focus () is called (focus in/out event) and it is dispose the toolitem. The fix should be simple, I'll try the reproduce the problem.
Works for me on Version: 4.1.0 Build id: I20101014-1937 running no Linux Fedora 11
This testcase simulates what I think the bug in E4 is, run the snippet and press tab import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; public class PR328173 { public static void main (String[] args) { Display display= new Display(); Shell shell= new Shell(display); shell.setLayout(new GridLayout(1, false)); final Button button = new Button(shell, SWT.PUSH); button.setText("button"); ToolBar bar = new ToolBar (shell,SWT.NONE); final ToolItem item0 = new ToolItem(bar, SWT.PUSH); item0.setText("item0"); ToolItem item1 = new ToolItem(bar, SWT.PUSH); item1.setText("item1"); display.addFilter(SWT.FocusIn, new Listener() { public void handleEvent(Event e) { System.out.println("focus in " + e.widget); } }); display.addFilter(SWT.FocusOut, new Listener() { public void handleEvent(Event e) { System.out.println("focus out " + e.widget); if (e.widget == button) item0.dispose(); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
Created attachment 181308 [details] patch
I fixed the crash (code released in HEAD). That said, GTK doesn't like that we release the widget that is receiving focus during gtk_widget_grab_focus() and prints our several warnings. I can silence the warnings using Device.setWarnings(false) before calling gtk_widget_grab_focus(). Silenio, does that make sense to you ?
Code has been released years ago. Resolving.