Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange error when disposing a new Browser instance immediately after creating it #1664

Open
merks opened this issue Dec 14, 2024 · 0 comments

Comments

@merks
Copy link
Contributor

merks commented Dec 14, 2024

When using the latest target platform, starting the installer logs exceptions like this:

!MESSAGE No more handles [0x8007139f]
!STACK 0
org.eclipse.swt.SWTError: No more handles [0x8007139f]
	at org.eclipse.swt.SWT.error(SWT.java:4962)
	at org.eclipse.swt.browser.Edge.error(Edge.java:225)
	at org.eclipse.swt.browser.Edge.setupBrowser(Edge.java:600)
	at org.eclipse.swt.browser.Edge.lambda$10(Edge.java:580)
	at org.eclipse.swt.browser.Edge.lambda$5(Edge.java:232)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3693)
	at org.eclipse.oomph.setup.internal.installer.Installer.runEventLoop(Installer.java:382)
	at org.eclipse.oomph.setup.internal.installer.SimpleInstallerDialog.runEventLoop(SimpleInstallerDialog.java:1001)
	at org.eclipse.oomph.setup.internal.installer.AbstractSimpleDialog.show(AbstractSimpleDialog.java:195)
	at org.eclipse.oomph.setup.internal.installer.InstallerApplication.run(InstallerApplication.java:295)
	at org.eclipse.oomph.setup.internal.installer.InstallerApplication.start(InstallerApplication.java:401)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)

I was messing around with the code that tests whether a browser can be created:

  public static synchronized boolean isBrowserAvailable()
  {
    if (browserAvailable == null)
    {
      syncExec(new Runnable()
      {
        @Override
        public void run()
        {
          Shell shell = null;

          try
          {
            shell = new Shell();
            new Browser(shell, SWT.NONE);
            while (shell.getDisplay().readAndDispatch())
            {
            }
            browserAvailable = true;
          }
          catch (SWTError ex)
          {
            browserAvailable = false;
          }
          finally
          {
            try
            {
              shell.dispose();
            }
            catch (Exception ex)
            {
              // Ignore.
            }
          }
        }
      });
    }

    return browserAvailable;
  }

Adding the while (shell.getDisplay().readAndDispatch()) makes the problem go away, so I think if one creates a browser and disposes it, there are maybe still events processed later for that browser that fail in this strange way. Does anything guard that you aren't trying to process something for a disposed Edge instance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant