MEDIUM: Should fix issues with infinite loop switching between windows
(can be systematically reproduced on Linux with a JVM 64-bits)