Commit db9cac07 by nduca@chromium.org

Don't unsubclass the surface's output window if the window has been destroyed.

Review URL: http://codereview.appspot.com/3357041 git-svn-id: https://angleproject.googlecode.com/svn/trunk@499 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent d32941b9
...@@ -343,16 +343,20 @@ void Surface::unsubclassWindow() ...@@ -343,16 +343,20 @@ void Surface::unsubclassWindow()
{ {
if(!mWindowSubclassed) if(!mWindowSubclassed)
return; return;
// un-subclass
LONG parentWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
// Check the windowproc is still SurfaceWindowProc. // Check the windowproc is still SurfaceWindowProc.
// If this assert fails, then it is likely the application has subclassed the // If this assert fails, then it is likely the application has subclassed the
// hwnd as well and did not unsubclass before destroying its EGL context. The // hwnd as well and did not unsubclass before destroying its EGL context. The
// application should be modified to either subclass before initializing the // application should be modified to either subclass before initializing the
// EGL context, or to unsubclass before destroying the EGL context. // EGL context, or to unsubclass before destroying the EGL context.
ASSERT(GetWindowLong(mWindow, GWL_WNDPROC) == reinterpret_cast<LONG>(SurfaceWindowProc)); if(parentWndFunc) {
LONG prevWndFunc = SetWindowLong(mWindow, GWL_WNDPROC, parentWndFunc);
ASSERT(prevWndFunc == reinterpret_cast<LONG>(SurfaceWindowProc));
}
// un-subclass
LONG prevWndFunc = reinterpret_cast<LONG>(GetProp(mWindow, kParentWndProc));
SetWindowLong(mWindow, GWL_WNDPROC, prevWndFunc);
RemoveProp(mWindow, kSurfaceProperty); RemoveProp(mWindow, kSurfaceProperty);
RemoveProp(mWindow, kParentWndProc); RemoveProp(mWindow, kParentWndProc);
mWindowSubclassed = false; mWindowSubclassed = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment