Skip to content

[Linux] Crash to desktop in Browser using OpenWindowListener #3416

Description

@Phillipus

On Linux with the latest SWT I-build run the following snippet and click the "Click" link. It should open the link in the Browser but after a few seconds quits to desktop. In an RCP app the whole app quits to desktop.

  • Works on Windows and Mac
  • Crashes on Linux Mint 22.3 (X11) and Ubuntu 26.04 (Wayland)
  • Java 21
  • Latest SWT I-build
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SWTBrowserTest {
    
    public static void main(String[] args) {
        final Display display = new Display();

        final Shell shell = new Shell(display);
        shell.setText("SWT Browser");
        shell.setLayout(new FillLayout());
        shell.setSize(400, 400);
        
        Browser browser = new Browser(shell, SWT.NONE);
        browser.setText("<a href='https://www.eclipse.org' target='_blank'>Click</a>");
        
        browser.addOpenWindowListener(event -> {
            event.browser = browser;
        });
        
        shell.open();

        while(!shell.isDisposed()) {
            if(!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linux/GTKHappens on LinuxbugSomething isn't workingregressionSomething that used to work

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions