Destroy D3D after destroying the window. Fixes another DestroyWindow

crash: start in fullscreen, change to a window, close the game.

This is sort of trial-and-error: there seems to be no documentation about
the proper order of shutting down a window.  Shutting down D3D first
makes sense: restore the window to normal, then destroy it, so we don't
kill the window while D3D is still using it.  But this seems to work, and
it's how we did it in 3.9.

(I think releasing D3D first is leaving traces behind in the window, which
then cause stale dereferences; the previous FreeLibrary() change was for
the same problem, and this seems to just be another incarnation of that.)

7c918fea: ntdll!RtlpWaitForCriticalSection [7c900000+18f8f+5b]
77d48bd9: USER32!GetWindowThreadProcessId [77d40000+8a80+159]
77d4b3cc: USER32!DefWindowProcW [77d40000+b33c+90]
7c90104b: ntdll!RtlEnterCriticalSection [7c900000+1005+46]
6d9ab228: D3D8!CheckFullscreen [6d9a0000+b060+1c8]
77d48734: USER32!GetDC [77d40000+86c7+6d]
77d4b4c0: USER32!DefWindowProcW [77d40000+b33c+184]
7c90eae3: ntdll!KiUserCallbackDispatcher [7c900000+ead0+13]
77d4daf6: USER32!DestroyWindow [77d40000+daea+c]
00539971: void GraphicsWindow::DestroyGraphicsWindow(void) [00400000+1398d1+a0]
This commit is contained in:
Glenn Maynard
2006-04-10 15:08:04 +00:00
parent 533e784008
commit 7a94b959c9
+2 -2
View File
@@ -281,6 +281,8 @@ RageDisplay_D3D::~RageDisplay_D3D()
{
LOG->Trace( "RageDisplay_D3D::~RageDisplay()" );
GraphicsWindow::Shutdown();
if( g_pd3dDevice )
{
g_pd3dDevice->Release();
@@ -293,8 +295,6 @@ RageDisplay_D3D::~RageDisplay_D3D()
g_pd3d = NULL;
}
GraphicsWindow::Shutdown();
/* Even after we call Release(), D3D may still affect our window. It seems to subclass
* the window, and never release it. Free the DLL after destroying the window. */
#if !defined(XBOX)