Issue1797

classification
Title: Swing windows do not stay open without an infinite loop.
Type: Severity: normal
Components: Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: amak Nosy List: amak, camjackson, irmen
Priority: Keywords:

Created on 2011-09-16.01:53:54 by camjackson, last changed 2012-03-20.20:38:10 by amak.

Messages
msg6648 (view) Author: Cam Jackson (camjackson) Date: 2011-09-16.01:53:53
Take this very simple code: 

    from javax.swing import JFrame

    window = JFrame('Test', 
                    defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
                    size = (800, 600))
    window.visible = True

The created window opens for a few seconds, and then closes. The only way I have found to keep the window open is by adding `while True: pass` after showing it, so it might be something to do with `window` going out of scope and being cleaned up, forcing it to close.

I have also encountered what I believe to be a more complicated manifestation of the same bug, which is best-documented here: http://stackoverflow.com/questions/6991878/why-is-my-file-getting-closed-if-i-dont-do-anything-with-it-for-a-while
msg6713 (view) Author: Irmen de Jong (irmen) Date: 2011-11-06.23:32:01
Can't reproduce this, on my computer the window stays open. Tested it on windows 7 with JDK1.6 and OSX with jdk1.5, from the interactive prompt
msg6714 (view) Author: Cam Jackson (camjackson) Date: 2011-11-06.23:43:34
I just tried it from the interactive prompt, and the bug is not there. So the problem is only when running a script. I would guess that this is because the 'window' variable is being kept in scope by the prompt environment, so the window stays open.

Are you able to reproduce the bug from a .py script? For reference, I'm running Jython 2.5.2, Java 1.6.0_24, on Windows XP.
msg6839 (view) Author: Alan Kennedy (amak) Date: 2012-03-19.19:20:28
Two other users have reported that they cannot reproduce this issue, on two different platforms.

Without further information to help reproduce, we'll just have to close this one as "cannot reproduce", "user doesn't understand swing API".
msg6841 (view) Author: Alan Kennedy (amak) Date: 2012-03-19.19:27:01
Sorry, I should say that I cannot reproduce this issue either in a script or at the interactive prompt.

Platform Windows 2003, jython trunk, JDK 1.6.
msg6894 (view) Author: Cam Jackson (camjackson) Date: 2012-03-19.22:15:28
I discovered this bug at work, on an XP machine. I haven't tried to reproduce it at home yet, on Win7. Before you close, give me a chance to try to reproduce this at home first. I'll update here again after I've tried.
msg6920 (view) Author: Cam Jackson (camjackson) Date: 2012-03-20.11:08:10
Hmm, I am unable to reproduce this on Windows 7 (x64), Jython 2.5.3b1, Java 1.7. Not sure what difference is causing the behaviour not to occur, but it definitely happened as I describe on XP 32 bit, Jython 2.5.1, Java 1.6.

You can close this as no repro, but please don't put 'user doesn't understand API'. That's not true, and frankly, a little insulting.
msg6931 (view) Author: Alan Kennedy (amak) Date: 2012-03-20.20:38:10
Closing as "cannot reproduce", i.e. "works for me".
History
Date User Action Args
2012-03-20 20:38:10amaksetstatus: open -> closed
resolution: works for me
messages: + msg6931
2012-03-20 11:08:10camjacksonsetmessages: + msg6920
2012-03-19 22:15:28camjacksonsetmessages: + msg6894
2012-03-19 19:27:01amaksetmessages: + msg6841
2012-03-19 19:20:29amaksetassignee: amak
messages: + msg6839
nosy: + amak
2011-11-06 23:43:34camjacksonsetmessages: + msg6714
2011-11-06 23:32:01irmensetnosy: + irmen
messages: + msg6713
2011-09-16 01:53:54camjacksoncreate