mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Fixed segfault on exit by integrating pull request #378 by tomgreen66
This commit is contained in:
parent
0aae6f0902
commit
b14c3c21cb
2 changed files with 22 additions and 11 deletions
|
@ -272,7 +272,6 @@ idSaveLoadParms::~idSaveLoadParms
|
|||
*/
|
||||
idSaveLoadParms::~idSaveLoadParms()
|
||||
{
|
||||
/* SRS - Don't need to repeat this code here, since auto-deletes are already handled by idSaveGameManager::FinishProcessor
|
||||
for( int i = 0; i < files.Num(); ++i )
|
||||
{
|
||||
if( files[i]->type & SAVEGAMEFILE_AUTO_DELETE )
|
||||
|
@ -280,7 +279,6 @@ idSaveLoadParms::~idSaveLoadParms()
|
|||
delete files[i];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -356,6 +356,7 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi
|
|||
{
|
||||
idSaveLoadParms& parms = processorLoadFiles->GetParmsNonConst();
|
||||
saveGameHandle_t handle = 0;
|
||||
bool checkDetailsFile = true;
|
||||
|
||||
{
|
||||
// Put in a local block so everything will go in the global heap before the map change, but the heap is
|
||||
|
@ -414,16 +415,28 @@ saveGameHandle_t idSessionLocal::LoadGameSync( const char* name, saveFileEntryLi
|
|||
parms.errorCode = SAVEGAME_E_UNKNOWN;
|
||||
}
|
||||
|
||||
if( parms.GetError() != SAVEGAME_E_NONE )
|
||||
// SRS - check details file for compatibility before removing it from parms.files list
|
||||
if( parms.GetError() == SAVEGAME_E_NONE )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Checks the description file to see if corrupted or if it's from a newer savegame
|
||||
if( !LoadGameCheckDescriptionFile( parms ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Checks the details file to see if corrupted or if it's from a newer savegame
|
||||
checkDetailsFile = LoadGameCheckDescriptionFile( parms );
|
||||
}
|
||||
|
||||
// tomgreen66 - remove details file we added via auto_ptr to parms.files in InitLoadFiles above
|
||||
for ( int i = 0; i < parms.files.Num(); ++i )
|
||||
{
|
||||
if ( parms.files[i] == gameDetailsFile.get() )
|
||||
{
|
||||
// details file reference will be deleted by auto_ptr so remove it from list and update file count
|
||||
parms.files.RemoveIndexFast( i );
|
||||
}
|
||||
}
|
||||
|
||||
// SRS - return if savegame error or description file corrupt or not compatible
|
||||
if( parms.GetError() != SAVEGAME_E_NONE || !checkDetailsFile )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Checks to see if loaded map is from a DLC map and if that DLC is active
|
||||
if( !IsDLCAvailable( parms.description.GetMapName() ) )
|
||||
|
|
Loading…
Reference in a new issue