Programm exit?

If the event thread is active, it means you didn't properly dispose of all your frames. Make sure to call JFrame.dispose() on all frames that you create after closing them.

After closing them? I don't close them, I only set them to visible false. I'll try to dispose them all in the cleanup method.



Edit: It didn't work by disposing every frames, but it worked by disposing the jmeDesktop.

I am experiencing the same issue and have read all related threads. My concrete situation is: I setup StandardGame and then build up my GameState. If the window is closed before Setup is complete, the main thread waits on Future for ever. This seems to be a common problem for nearly every game that uses StandardGame.



There were different offered solutions:



Solution 1: after call of StandardGame.start() first register a game state that calls System.exit in its cleanup method, or checks if Threads are running and interrupt them. (Zsazsa message)



Solution 2: make all other threads daemon threads (Mimic_Fan’s message)



I thought of a third solution for my occurring Future.get() lock that was also discussed: cleanup the GameTaskQueueManager in StandardGame.cleanup, so that it interrupts all waiting threads. But this cannot work correctly because the start up may be still in progress when the game is shut down, and later then calls GameTaskQueueManager.getManager().update(…).get(). So it is a good thing that GameTaskQueueManager does not have such a cleanup/cancelAll method and GameTask.cancel is never called for this purpose.



The first solution should be the more general one, since cleanup works can be done if necessary.

Still if System.exit(0) is called directly from a GameState, my virtual machine crashes with an EXCEPTION_ACCESS_VIOLATION which is due to missing cleanup work that still has to be done by StandardGame. So I worked out a general solution based on the game state workaround which should work for everybody.



I added it to the user code section: Clean shutdown of StandardGame



Now I feel this should be integrated into StandardGame and JME in a more clean way because my solution is and is looking like a workaround.



I am currently working on a proposal and post it as soon it is ready.