From a32d30c1be541219086f39a852855dfb1559330d Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Sat, 21 Nov 2009 21:39:31 +0000 Subject: [PATCH] Fixed a memory leak in sf::Window implementation on Windows Synchronized sfml2 with trunk git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1280 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Window/Win32/WindowImplWin32.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index d613e556..8ae110e5 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -150,10 +150,12 @@ myIsCursorIn (false) RegisterWindowClass(); // Compute position and size - int Left = (GetDeviceCaps(GetDC(NULL), HORZRES) - Mode.Width) / 2; - int Top = (GetDeviceCaps(GetDC(NULL), VERTRES) - Mode.Height) / 2; + HDC ScreenDC = GetDC(NULL); + int Left = (GetDeviceCaps(ScreenDC, HORZRES) - Mode.Width) / 2; + int Top = (GetDeviceCaps(ScreenDC, VERTRES) - Mode.Height) / 2; int Width = myWidth = Mode.Width; int Height = myHeight = Mode.Height; + ReleaseDC(NULL, ScreenDC); // Choose the window style according to the Style parameter DWORD Win32Style = WS_VISIBLE;