Patch for LWJGLDisplaySystem.java

(I looked for a patch submission procedure, but didn't find one. If there is a policy, please let me know and I'll follow that.)



This issue manifests as a replicatable spontaneous reboot on at least one system, and a hang or crash on others.



On line 457 in com.jme.system.lwjgl.LWJGLDisplaySystem, method: reinitDisplay()



        try {
            Display.setDisplayMode( mode );
            Display.setFullscreen( fs );
        } catch ( Exception e ) {



Calling the following method after having created a fullscreen window with the same properties causes my system to spontaneously reboot, and appears to cause other systems to hang or crash:


DisplaySystem ds = DisplaySystem.getDisplaySystem("LWJGL");
...
ds.recreateWindow(800, 600, 32, 60, false);



Adding releaseContext() and makeCurrent() fixes the problem and I can switch in and out of fullscreen without issue, and the aforementioned "other" systems seem to work without crashing as well:


        try {
+         Display.releaseContext();
            Display.setDisplayMode( mode );
            Display.setFullscreen( fs );
+         Display.makeCurrent();
        } catch ( Exception e ) {



This has been tested with and without those two lines numerous times with no other changes the codebase, and my system reboots without exception when leaving fullscreen mode if those two lines are not in place.

I suspect this may fix other hang and crash issues with window resizing as well.

Thanks for all of your efforts on jME.

Thanks for reporting this.  Can you replicate the crash using TestRecreateWindow?  I can't seem to recreate the crash or hang on any of my machines and I'm curious if it is a particular set of conditions or just hardware dependant.

I'm also curious what video-hardware/driver/os combination caused this for you…

Well hmmm…  :oops:



The test runs just fine, no problems… That's embarrassing…



There's probably something in our codebase that has caused this behavior. I'd like be able to say exactly what, but at the current juncture, I don't have the time to put in to figure out what about our particular implementation is different. I will try to schedule some time for working with the resize test and see if I can re-create the crash in a clean setup.



As for my system: WinXP Pro, Pentium 4 3.0GHz 1.5GB Ram, and an ATI FireGL V3100



… Still, perhaps it will be useful if there is anyone else seeing the same thing.



Thanks for the swift response.