hmm, previous check in caused a crash on toontown, this fixes it

This commit is contained in:
Asad M. Zaman 2004-05-26 01:22:09 +00:00
parent f9c4643c93
commit 1c5385b973
2 changed files with 14 additions and 7 deletions

View File

@ -4509,12 +4509,16 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
// if(bAtExitFnEverCalled)
// return;
if (!_pD3DDevice)
return;
// unsafe to do the D3D releases after exit() called, since DLL_PROCESS_DETACH
// msg already delivered to d3d.dll and it's unloaded itself
wdxdisplay8_cat.debug() << "called dx_cleanup\n";
free_nondx_resources();
wdxdisplay8_cat.debug() << "device : " << _pD3DDevice << endl;
PRINT_REFCNT(dxgsg8,_pD3DDevice);
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)
@ -4526,13 +4530,11 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
// Do a safe check for releasing the D3DDEVICE. RefCount should be zero.
// if we're called from exit(), _pD3DDevice may already have been released
if (_pD3DDevice!=NULL) {
for(int i=0;i<D3D_MAXTEXTURESTAGES;i++)
_pD3DDevice->SetTexture(i,NULL); // d3d should release this stuff internally anyway, but whatever
RELEASE(_pD3DDevice,dxgsg8,"d3dDevice",RELEASE_DOWN_TO_ZERO);
_pScrn->pD3DDevice = NULL;
}
for(int i=0;i<D3D_MAXTEXTURESTAGES;i++)
_pD3DDevice->SetTexture(i,NULL); // d3d should release this stuff internally anyway, but whatever
RELEASE(_pD3DDevice,dxgsg8,"d3dDevice",RELEASE_DOWN_TO_ZERO);
_pScrn->pD3DDevice = NULL;
// Releasing pD3D is now the responsibility of the GraphicsPipe destructor
}

View File

@ -4513,11 +4513,16 @@ dx_cleanup(bool bRestoreDisplayMode,bool bAtExitFnCalled) {
// if(bAtExitFnEverCalled)
// return;
if (!_pD3DDevice)
return;
// unsafe to do the D3D releases after exit() called, since DLL_PROCESS_DETACH
// msg already delivered to d3d.dll and it's unloaded itself
wdxdisplay9_cat.debug() << "called dx_cleanup\n";
free_nondx_resources();
wdxdisplay9_cat.debug() << "device : " << _pD3DDevice << endl;
PRINT_REFCNT(dxgsg9,_pD3DDevice);
// delete non-panda-texture/geom DX objects (VBs/textures/shaders)