Hi Ralf, I didn't see any answer to your mail about GraphicsWindowWin32. Did I miss something? If not intrusive, may it be integrated in the 2.8.0 (while we're still in RC)?
Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Mon, 09 Feb 2009 19:29:04 +0100, Ralf Habacker <[email protected]> a écrit: > Hi, > > on win32 there is a memory leak in recent svn code in > GraphicsWindowWin32.cpp. > > in bool GraphicsWindowWin32::setWindow( HWND handle ) > > there is the following if/else statement > > if (_traits.valid() && _traits->setInheritedWindowPixelFormat) > .... > else > setPixelFormat() > _hglrc = ::wglCreateContext(...) [1] > > setPixelFormat() calls wglCreateContext() and saves the result into > _hglrc which is overwritten by a second call to wglCreateContext() call > at [1] > > The same behavior occurs in bool > Win32WindowingSystem::getSampleOpenGLContext( OpenGLContext& context, > HDC windowHDC, int windowOriginX, int windowOriginY ). > > The solution for this issue is to move the wglCreateContext() out of > setPixelFormat() and to place it into the caller which is done to the > appended file > > Because of this fix the following code in GraphicsWindowWin32::setWindow > > if (_traits.valid() && _traits->setInheritedWindowPixelFormat) > { > if (!setPixelFormat()) > { > reportErrorForScreen("GraphicsWindowWin32::setWindow() - > Unable to set the inherited window pixel format", _traits->screenNum, > ::GetLastError()); > _hdc = 0; > _hwnd = 0; > return false; > } > } > else > { > // > // Create the OpenGL rendering context associated with this window > // > if (!setPixelFormat()) > { > reportErrorForScreen("GraphicsWindowWin32::setWindow() - > Unable to set the inherited window pixel format", _traits->screenNum, > ::GetLastError()); > _hdc = 0; > _hwnd = 0; > return false; > } > _hglrc = ::wglCreateContext(_hdc); > if (_hglrc==0) > { > reportErrorForScreen("GraphicsWindowWin32::setWindow() - > Unable to create OpenGL rendering context", _traits->screenNum, > ::GetLastError()); > ::ReleaseDC(_hwnd, _hdc); > _hdc = 0; > _hwnd = 0; > return false; > } > } > > code be reduced to > > if (!setPixelFormat()) > { > reportErrorForScreen("GraphicsWindowWin32::setWindow() - > Unable to set the inherited window pixel format", _traits->screenNum, > ::GetLastError()); > _hdc = 0; > _hwnd = 0; > return false; > } > > _hglrc = ::wglCreateContext(_hdc); > if (_hglrc==0) > { > reportErrorForScreen("GraphicsWindowWin32::setWindow() - > Unable to create OpenGL rendering context", _traits->screenNum, > ::GetLastError()); > ::ReleaseDC(_hwnd, _hdc); > _hdc = 0; > _hwnd = 0; > return false; > } > } > > Regards > Ralf _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
