Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8243328

Launching JavaFX from LibreOffice on Linux and Mac causes JVM crash

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux and Ubuntu

      A DESCRIPTION OF THE PROBLEM :
      Launching JavaFX WebView from LibreOffice on Linux causes JVM crash.
      Debugging reveals that the JFXPanel fxPanel = new JFXPanel(); causes the crash.
      internally i see that initFx() method of JFXPanel class fails.

      REGRESSION : Last worked in version 15

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a starter project of LibreOffice Extension
      In the button click of the extension try to launch any JFXPanel embedding it in JFrame.
      launching the dialog causes the crash of JVM and LibreOffice too.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JFXPanel should load the given URL
      ACTUAL -
      Crash

      ---------- BEGIN SOURCE ----------
      protected void testPanel() {
      try{
      String url ="www.google.com";
      JFrame myFrame = new JFrame();
      JFXPanel jfxPanel = new JFXPanel();
      myFrame.add(jfxPanel);
      PlatformImpl.setImplicitExit(false);
      PlatformImpl.runLater(() -> {
      try {
      WebView webView = new WebView();
      jfxPanel.setScene(new Scene(webView));
      webView.getEngine().setJavaScriptEnabled(true);
      webView.getEngine().setUserDataDirectory(
      new File(FileSystems.getDefault().getPath(".").toAbsolutePath().toString()));
      webView.getEngine().load(url);
      webView.getEngine().getLoadWorker().stateProperty().addListener((obs, oldValue, newValue) -> {
      if (newValue == Worker.State.SUCCEEDED) {
      webView.getEngine().setOnAlert(new EventHandler<WebEvent<String>>() {
      @Override
      public void handle(WebEvent<String> arg0) {
      JOptionPane.showMessageDialog(null, arg0.getData(), "Message",
      JOptionPane.INFORMATION_MESSAGE);
      }
      });
      }
      if (newValue == Worker.State.FAILED) {
      JOptionPane.showMessageDialog(null, "Unable to load " + title + ". Please try relaunching the page.", "Error",
      JOptionPane.ERROR_MESSAGE);
      }
      });
      } catch (Exception e) {
      JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
      }
      });
      myFrame.setSize(500, 500);
      myFrame.setLocationRelativeTo(null);
      myFrame.setTitle(title);
      myFrame.setVisible(true);
      }
      catch(Exception e){
      JOptionPane.showMessageDialog(null, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
      }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: