Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366168

Summary: JVM chashes
Product: [Eclipse Project] Platform Reporter: Costin Arsene <costinarsene>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: critical    
Priority: P3 CC: costinarsene, eclipse.felipe, emiliamatei11, grant_gayed, info, irbull, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Costin Arsene CLA 2011-12-09 05:42:58 EST
Build Identifier: SWT 3.7

package swtbrowser;

import java.awt.Dimension;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;

public class SWTBrowser {

  public static void main(String[] args) throws InterruptedException {
    SwingUtilities.invokeLater(new Runnable() {

      @Override
      public void run() {
        final JFrame jFrame = new JFrame();
        jFrame.setSize(new Dimension(400, 500));
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton jb = new JButton("Test Browser");
        jb.addActionListener(new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            executeBrowser(jFrame);
          }
        });
        jFrame.add(jb);
        jFrame.setVisible(true);

      }

      private void executeBrowser(final JFrame jFrame) throws HeadlessException {
        jFrame.setVisible(false);
        new SwingWorker<Object, Object>() {

          @Override
          protected Object doInBackground() throws Exception {
            geneateBrowser(jFrame);

            return null;
          }

          @Override
          protected void done() {
          }
        }.execute();
      }
    });
  }
  static Display display = null;

  private static void geneateBrowser(JFrame frame) {

    Display display = new Display();
    Shell shell = new Shell(display); //create window

    shell.setLayout(new FillLayout());

    Browser browser = new Browser(shell, SWT.WEBKIT); //create browser 
    browser.setUrl("http://www.google.com");
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    frame.setVisible(true);
    
  }
}





Reproducible: Always

Steps to Reproduce:
1.Start the application 
2.Press Test Browser Button 
3.Close Browser
4.Press Test Browser Button 
5.Close Browser
6.Press Test Browser Button 
7.Close Browser
8. The JVM crashes
9.JVM USED ORACLE (SUN) JRE 1.6.0_29 (32 bit version)  or any JRE above 1.6.0_29  (32 bit) and on any Windows Operating System (tested on WINDOWS XP ,WINDOWS VISTA, WINDOWS 7)
10. If I change SWT.WEBKIT whith SWT.NONE everything works perfectly.The problem is that I need the Webkit ENGINE.
Comment 1 Costin Arsene CLA 2011-12-09 06:39:56 EST
I want to make a correction . Insted of "or any JRE above 1.6.0_29  (32 bit)" I wanted to say "or any JRE above 1.6.0_20  (32 bit)".
Comment 2 Costin Arsene CLA 2011-12-09 06:41:26 EST
I want to make a correction . Insted of "or any JRE above 1.6.0_29  (32 bit)" I wanted to say "or any JRE above 1.6.0_20  (32 bit)".
Comment 3 Eclipse Genie CLA 2020-06-17 14:25:42 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.