shell close() stack overflow [message #100982] |
Mon, 01 August 2005 16:15  |
Eclipse User |
|
|
|
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 11:02  |
Eclipse User |
|
|
|
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 11:02  |
Eclipse User |
|
|
|
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();
> }
> });
> }
> }
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05332 seconds