Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » shell close() stack overflow
shell close() stack overflow [message #100982] Mon, 01 August 2005 20:15 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2009
Junior Member
Running an SWT application (created in VE 1.1) on Windows causes a
StackOverflowError when running inside the Eclipse IDE. The shell event
listener listens for a close event. When closing the app via the "X" close
button in the upper right of the window, it continually loops on the
calling the shellClosed() listener method over and over, finally choking
on itself. Should I completely remove the call to sShell.close(). Why? See
the sample program below. Try it. Thanks for any responses!

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.SWT;

public class testblah {

private Shell sShell = null;

public static void main(String[] args) {
Display display = Display.getDefault();
testblah thisClass = new testblah();
thisClass.createSShell();
thisClass.sShell.open();

while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
sShell.addShellListener(new org.eclipse.swt.events.ShellAdapter() {
public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
sShell.close();
sShell.dispose();
}
});
}
}
Re: shell close() stack overflow [message #101258 is a reply to message #100982] Wed, 03 August 2005 15:02 Go to previous message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
SWT Shell on a windows system is a native Windows Shell. When you close
the shell, all it does is provide a 'shellClosed' notification that it
is closing and then disposes itself. There is no need to do the closing
yourself.
Regards,
Sri.

Dave Loomis wrote:
> Running an SWT application (created in VE 1.1) on Windows causes a
> StackOverflowError when running inside the Eclipse IDE. The shell event
> listener listens for a close event. When closing the app via the "X"
> close button in the upper right of the window, it continually loops on
> the calling the shellClosed() listener method over and over, finally
> choking on itself. Should I completely remove the call to
> sShell.close(). Why? See the sample program below. Try it. Thanks for
> any responses!
>
> import org.eclipse.swt.graphics.Point;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.SWT;
>
> public class testblah {
>
> private Shell sShell = null;
>
> public static void main(String[] args) {
> Display display = Display.getDefault();
> testblah thisClass = new testblah();
> thisClass.createSShell();
> thisClass.sShell.open();
>
> while (!thisClass.sShell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
>
> private void createSShell() {
> sShell = new Shell();
> sShell.setText("Shell");
> sShell.setSize(new Point(300, 200));
> sShell.addShellListener(new org.eclipse.swt.events.ShellAdapter() {
> public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
> sShell.close();
> sShell.dispose();
> }
> });
> }
> }
>
>
Re: shell close() stack overflow [message #610135 is a reply to message #100982] Wed, 03 August 2005 15:02 Go to previous message
Srimanth  is currently offline Srimanth Friend
Messages: 225
Registered: July 2009
Senior Member
SWT Shell on a windows system is a native Windows Shell. When you close
the shell, all it does is provide a 'shellClosed' notification that it
is closing and then disposes itself. There is no need to do the closing
yourself.
Regards,
Sri.

Dave Loomis wrote:
> Running an SWT application (created in VE 1.1) on Windows causes a
> StackOverflowError when running inside the Eclipse IDE. The shell event
> listener listens for a close event. When closing the app via the "X"
> close button in the upper right of the window, it continually loops on
> the calling the shellClosed() listener method over and over, finally
> choking on itself. Should I completely remove the call to
> sShell.close(). Why? See the sample program below. Try it. Thanks for
> any responses!
>
> import org.eclipse.swt.graphics.Point;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.SWT;
>
> public class testblah {
>
> private Shell sShell = null;
>
> public static void main(String[] args) {
> Display display = Display.getDefault();
> testblah thisClass = new testblah();
> thisClass.createSShell();
> thisClass.sShell.open();
>
> while (!thisClass.sShell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
>
> private void createSShell() {
> sShell = new Shell();
> sShell.setText("Shell");
> sShell.setSize(new Point(300, 200));
> sShell.addShellListener(new org.eclipse.swt.events.ShellAdapter() {
> public void shellClosed(org.eclipse.swt.events.ShellEvent e) {
> sShell.close();
> sShell.dispose();
> }
> });
> }
> }
>
>
Previous Topic:VE1.1 wonŽt work
Next Topic:Jlabel border
Goto Forum:
  


Current Time: Fri Apr 19 08:39:54 GMT 2024

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

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

Back to the top