Windows: Clean up window in case of exception thrown from WindowsDisplay.createWindow
This commit is contained in:
parent
b11fcc99f6
commit
b6b83936ac
|
@ -173,14 +173,19 @@ final class WindowsDisplay implements DisplayImplementation {
|
|||
nDestroyWindow(hwnd, hdc);
|
||||
throw new LWJGLException("Failed to get dc");
|
||||
}
|
||||
peer_info.initDC(getHwnd(), getHdc());
|
||||
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue