fix findings.

pull/1730/head
Kim Kulling 2018-01-23 13:02:13 +01:00
parent 98c053a9b9
commit ebaa8be106
2 changed files with 26 additions and 55 deletions

View File

@ -118,7 +118,7 @@ void MakeFileAssociations()
D3DCOLOR_ARGB(0xFF,0,0xFF,0)); D3DCOLOR_ARGB(0xFF,0,0xFF,0));
CLogDisplay::Instance().AddEntry(tmp.data,D3DCOLOR_ARGB(0xFF,0,0xFF,0)); CLogDisplay::Instance().AddEntry(tmp.data,D3DCOLOR_ARGB(0xFF,0,0xFF,0));
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@ -128,17 +128,16 @@ void MakeFileAssociations()
// Other command line parameters are not handled // Other command line parameters are not handled
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
void HandleCommandLine(char* p_szCommand) void HandleCommandLine(char* p_szCommand)
{ {
char* sz = p_szCommand; char* sz = p_szCommand;
//bool bQuak = false; //bool bQuak = false;
if (strlen(sz) < 2)return; if (strlen(sz) < 2)return;
if (*sz == '\"') if (*sz == '\"') {
{
char* sz2 = strrchr(sz,'\"'); char* sz2 = strrchr(sz,'\"');
if (sz2)*sz2 = 0; if (sz2)*sz2 = 0;
sz++; // skip the starting quote sz++; // skip the starting quote
} }
strcpy( g_szFileName, sz ); strcpy( g_szFileName, sz );
@ -149,8 +148,7 @@ void HandleCommandLine(char* p_szCommand)
// Save the list of previous files to the registry // Save the list of previous files to the registry
SaveHistory(); SaveHistory();
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Load the light colors from the registry // Load the light colors from the registry
@ -158,16 +156,11 @@ void HandleCommandLine(char* p_szCommand)
void LoadLightColors() void LoadLightColors()
{ {
DWORD dwTemp = 4; DWORD dwTemp = 4;
RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, RegQueryValueEx(g_hRegistry,"LightColor0",NULL,NULL, (BYTE*)&g_avLightColors[0],&dwTemp);
(BYTE*)&g_avLightColors[0],&dwTemp); RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, (BYTE*)&g_avLightColors[1],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor1",NULL,NULL, RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL, (BYTE*)&g_avLightColors[2],&dwTemp);
(BYTE*)&g_avLightColors[1],&dwTemp);
RegQueryValueEx(g_hRegistry,"LightColor2",NULL,NULL,
(BYTE*)&g_avLightColors[2],&dwTemp);
return;
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Save the light colors to the registry // Save the light colors to the registry
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
@ -178,7 +171,6 @@ void SaveLightColors()
RegSetValueExA(g_hRegistry,"LightColor2",0,REG_DWORD,(const BYTE*)&g_avLightColors[2],4); RegSetValueExA(g_hRegistry,"LightColor2",0,REG_DWORD,(const BYTE*)&g_avLightColors[2],4);
} }
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Save the checker pattern colors to the registry // Save the checker pattern colors to the registry
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------

View File

@ -787,9 +787,17 @@ int ShutdownD3D(void)
return 1; return 1;
} }
template<class TComPtr>
inline
void SafeRelease(TComPtr *ptr) {
if (nullptr != g_piPassThroughEffect) {
g_piPassThroughEffect->Release();
g_piPassThroughEffect = nullptr;
}
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// Shutdown the D3D devie object and all resources associated with it // Shutdown the D3D device object and all resources associated with it
// NOTE: Assumes that the asset has already been deleted // NOTE: Assumes that the asset has already been deleted
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
int ShutdownDevice(void) int ShutdownDevice(void)
@ -798,49 +806,20 @@ int ShutdownDevice(void)
CBackgroundPainter::Instance().ReleaseNativeResource(); CBackgroundPainter::Instance().ReleaseNativeResource();
CLogDisplay::Instance().ReleaseNativeResource(); CLogDisplay::Instance().ReleaseNativeResource();
// release global shaders that have been allocazed // release global shaders that have been allocated
if (NULL != g_piDefaultEffect) SafeRelease(g_piDefaultEffect);
{ SafeRelease(g_piNormalsEffect);
g_piDefaultEffect->Release(); SafeRelease(g_piPassThroughEffect);
g_piDefaultEffect = NULL; SafeRelease(g_piPatternEffect);
} SafeRelease(g_pcTexture);
if (NULL != g_piNormalsEffect) SafeRelease(gDefaultVertexDecl);
{
g_piNormalsEffect->Release();
g_piNormalsEffect = NULL;
}
if (NULL != g_piPassThroughEffect)
{
g_piPassThroughEffect->Release();
g_piPassThroughEffect = NULL;
}
if (NULL != g_piPatternEffect)
{
g_piPatternEffect->Release();
g_piPatternEffect = NULL;
}
if (NULL != g_pcTexture)
{
g_pcTexture->Release();
g_pcTexture = NULL;
}
if( NULL != gDefaultVertexDecl)
{
gDefaultVertexDecl->Release();
gDefaultVertexDecl = NULL;
}
// delete the main D3D device object // delete the main D3D device object
if (NULL != g_piDevice) SafeRelease(g_piDevice);
{
g_piDevice->Release();
g_piDevice = NULL;
}
// deleted the one channel image allocated to hold the HUD mask // deleted the one channel image allocated to hold the HUD mask
delete[] g_szImageMask; delete[] g_szImageMask;
g_szImageMask = NULL; g_szImageMask = nullptr;
return 1; return 1;
} }