From Ralf Habacker, fix to memory leak in GraphicsWindowWin32.cpp. Merged from OSG-2.8 branch using svn command:
svn merge -r 9726:9727 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches/OpenSceneGraph-2.8
This commit is contained in:
parent
0adcfda07a
commit
abe28296ee
@ -1172,6 +1172,20 @@ bool GraphicsWindowWin32::createWindow()
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Create the OpenGL rendering context associated with this window
|
||||
//
|
||||
|
||||
_hglrc = ::wglCreateContext(_hdc);
|
||||
if (_hglrc==0)
|
||||
{
|
||||
reportErrorForScreen("GraphicsWindowWin32::createWindow() - Unable to create OpenGL rendering context", _traits->screenNum, ::GetLastError());
|
||||
::ReleaseDC(_hwnd, _hdc);
|
||||
_hdc = 0;
|
||||
destroyWindow();
|
||||
return false;
|
||||
}
|
||||
|
||||
Win32WindowingSystem::getInterface()->registerWindow(_hwnd, this);
|
||||
return true;
|
||||
}
|
||||
@ -1209,28 +1223,15 @@ bool GraphicsWindowWin32::setWindow( HWND handle )
|
||||
// Check if we must set the pixel format of the inherited window
|
||||
//
|
||||
|
||||
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());
|
||||
::ReleaseDC(_hwnd, _hdc);
|
||||
_hdc = 0;
|
||||
_hwnd = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
_hglrc = ::wglCreateContext(_hdc);
|
||||
if (_hglrc==0)
|
||||
{
|
||||
@ -1240,7 +1241,6 @@ bool GraphicsWindowWin32::setWindow( HWND handle )
|
||||
_hwnd = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!registerWindowProcedure())
|
||||
{
|
||||
@ -1566,17 +1566,6 @@ bool GraphicsWindowWin32::setPixelFormat()
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Create the OpenGL rendering context associated with this window
|
||||
//
|
||||
|
||||
_hglrc = ::wglCreateContext(_hdc);
|
||||
if (_hglrc==0)
|
||||
{
|
||||
reportErrorForScreen("GraphicsWindowWin32::setPixelFormat() - Unable to create OpenGL rendering context", _traits->screenNum, ::GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user