From 04b3657ca125d08c678f6f7ee2927f07f9e7c01a Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Fri, 16 Oct 2009 16:59:48 +0000 Subject: [PATCH] Bugfixed some of the ini creation code on startup. Bugfixed a memory leak when running blockdumps. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2015 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/IsoFileFormats.cpp | 1 + pcsx2/gui/AppConfig.cpp | 12 ++++++++---- pcsx2/gui/AppMain.cpp | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pcsx2/CDVD/IsoFileFormats.cpp b/pcsx2/CDVD/IsoFileFormats.cpp index 8bf9c560b8..3281881d1e 100644 --- a/pcsx2/CDVD/IsoFileFormats.cpp +++ b/pcsx2/CDVD/IsoFileFormats.cpp @@ -428,6 +428,7 @@ void isoClose(isoFile *iso) if (iso->handle) _closefile(iso->handle); if (iso->htable) _closefile(iso->htable); safe_free( iso->buffer ); + safe_free( iso->dtable ); safe_free( iso ); } diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 5cc20e5310..97cb3c6bb5 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -542,12 +542,16 @@ void RelocateLogfile() // void AppConfig_OnChangedSettingsFolder( bool overwrite ) { - PathDefs::GetDocuments().Mkdir(); - PathDefs::GetSettings().Mkdir(); + if( !UseAdminMode ) + PathDefs::GetDocuments().Mkdir(); + + GetSettingsFolder().Mkdir(); + + const wxString iniFilename( GetSettingsFilename() ); if( overwrite ) { - if( !wxRemoveFile( GetSettingsFilename() ) ) + if( wxFileExists( iniFilename ) && !wxRemoveFile( iniFilename ) ) throw Exception::AccessDenied( "Failed to overwrite settings; permission to file was denied." ); } @@ -556,7 +560,7 @@ void AppConfig_OnChangedSettingsFolder( bool overwrite ) // Bind into wxConfigBase to allow wx to use our config internally, and delete whatever // comes out (cleans up prev config, if one). - delete wxConfigBase::Set( OpenFileConfig( GetSettingsFilename() ) ); + delete wxConfigBase::Set( OpenFileConfig( iniFilename ) ); GetAppConfig()->SetRecordDefaults(); //wxGetApp().Source_SettingsChanged().Dispatch( SettingsEvt_IniOpening ); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 6307101c6f..45569cdbc0 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -316,6 +316,8 @@ void AppApplySettings( const AppConfig* oldconf, bool saveOnSuccess ) { AllowFromMainThreadOnly(); + g_Conf->Folders.ApplyDefaults(); + // Ensure existence of necessary documents folders. Plugins and other parts // of PCSX2 rely on them.