Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Dialog w/ SWT Browser crashes JVM on close
Dialog w/ SWT Browser crashes JVM on close [message #1430162] Wed, 24 September 2014 05:00
Kent Xu is currently offline Kent XuFriend
Messages: 7
Registered: August 2011
Junior Member
I created a simple Dialog with a SWT browser in it. Sometimes, the JVM crashes after I close the Dialog and click on anything on the desktop such as taskbar, or another application. This happens very often (usually within 3 attempts) and seems to be only happening on windows (tested on windows 7 and OSX).

Is anyone aware of this issue? Any tips for working around the problem is appreciated.

Here is the sample code. I have also attached the JVM crash log.

public class Test {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
Link link = new Link(shell, SWT.NONE);
String text = "<a>click here to launch dialog</a>";
link.setText(text);
link.pack();
link.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
Shell shell2 = new Shell(display); // optional, may also use
// shell
PieviewDialog pd = new PieviewDialog(shell2, null);
pd.open();
}
});
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

public static class PieviewDialog extends Dialog {
URL url;
Browser b;

public PieviewDialog(Shell parentShell, URL url) {
super(parentShell);
this.url = url;
}

protected Control createDialogArea(Composite parent) {
Composite com = (Composite) super.createDialogArea(parent);
b = new Browser(com, SWT.NONE);
b.setLayoutData(new GridData(800, 600));
b.setUrl("http://www.cnn.com");
return parent;

}
}
}
Previous Topic:Fatal Error in JRE using SWT
Next Topic:Linux SWT Browser JavaScript.window.close() method not working
Goto Forum:
  


Current Time: Thu Sep 26 03:13:28 GMT 2024

Powered by FUDForum. Page generated in 0.03389 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top