Bug 694 : A "noLoop()" sketch may be unresponsive to exit request
Last modified: 2007-12-15 07:42




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
davbol
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2007-11-28 10:37
As of 0135 on WinXPsp2 using provided JRE 1.4.2, a sketch using noLoop() may not
exit immediately upon pressing the 'X' close window button, but will wait until next
draw() completes (which, depending on how sketch is written and what triggers redraw
(), might not occur for some time). I know there's some sort of "delay exit until
after draw completes" mechanism in there to exit cleanly, but perhaps it isn't working
as intended when noLoop is in effect?

/**
to test:
click to draw line and give keyboard focus
then click the 'X' close button or press lowercase 'x'
note that sketch won't close til you click canvas or press lowercase 'r'
(that is, won't close until draw() occurs again)
*/

void setup() {
size(200,200,JAVA2D);
background(255);
stroke(0);
noLoop();
}

void draw() {
line(mouseX-10, mouseY-10, mouseX+10, mouseY+10);
}

void mousePressed() {
redraw();
}

void keyPressed() {
if (key=='r') redraw();
if (key=='x') exit();
}
Additional Comment #1 From fry 2007-11-29 09:28
thanks for the report. i can't reproduce it but i've fixed what i believe
to be the problem for 0136 (you're welcome to try out the svn version).
exit() won't close the window when running from inside the environment, but
should exit properly when running as a standalone application.
Additional Comment #2 From davbol 2007-11-29 11:57
fyi, confirmed that build 3740 works, and both the 'X' button on window frame and 'x'
exit() from code close sketch immediately when run from PDE. (on same machine
where both methods still fail with Beta 0135) - so whatever your guess was appears
to have been correct. :)
Additional Comment #3 From fry 2007-11-29 11:59
cool, thanks a lot for verifying.
Additional Comment #4 From fry 2007-12-15 07:42
*** Bug 702 has been marked as a duplicate of this bug. ***