From: <eli...@us...> - 2008-05-02 11:05:54
|
Revision: 3064 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3064&view=rev Author: elias_naur Date: 2008-05-02 04:05:49 -0700 (Fri, 02 May 2008) Log Message: ----------- Windows: Clean up window in case of exception thrown from WindowsDisplay.createWindow Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-05-01 09:55:54 UTC (rev 3063) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/WindowsDisplay.java 2008-05-02 11:05:49 UTC (rev 3064) @@ -173,13 +173,18 @@ nDestroyWindow(hwnd, hdc); throw new LWJGLException("Failed to get dc"); } - peer_info.initDC(getHwnd(), getHdc()); - int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true); - WindowsPeerInfo.setPixelFormat(getHdc(), format); - showWindow(getHwnd(), SW_SHOWDEFAULT); - if (parent == null) { - setForegroundWindow(getHwnd()); - setFocus(getHwnd()); + try { + int format = WindowsPeerInfo.choosePixelFormat(getHdc(), 0, 0, peer_info.getPixelFormat(), null, true, true, false, true); + WindowsPeerInfo.setPixelFormat(getHdc(), format); + peer_info.initDC(getHwnd(), getHdc()); + showWindow(getHwnd(), SW_SHOWDEFAULT); + if (parent == null) { + setForegroundWindow(getHwnd()); + setFocus(getHwnd()); + } + } catch (LWJGLException e) { + nDestroyWindow(hwnd, hdc); + throw e; } } private native long nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y, boolean undecorated, boolean child_window, long parent_hwnd) throws LWJGLException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |