Clean up memory leak of settings pages

This commit is contained in:
zilmar 2012-10-04 22:01:08 +10:00
parent d917cfc553
commit 1c6af2e321
2 changed files with 5 additions and 4 deletions

View File

@ -68,9 +68,6 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
::GetWindowRect(GetDlgItem(IDC_SETTING_INFO),&rcSettingInfo);
::MapWindowPoints(NULL,m_hWnd,(LPPOINT)&rcSettingInfo,2);
m_GeneralOptionsPage = new CGeneralOptionsPage(this,this->m_hWnd,rcSettingInfo );
m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo );
CConfigSettingSection * SettingsSection;
if (m_GameConfig)
@ -96,6 +93,9 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
m_Sections.push_back(SettingsSection);
}
m_GeneralOptionsPage = new CGeneralOptionsPage(this,this->m_hWnd,rcSettingInfo );
m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd,rcSettingInfo );
SettingsSection = new CConfigSettingSection(GS(TAB_OPTIONS));
SettingsSection->AddPage(m_GeneralOptionsPage);
SettingsSection->AddPage(m_AdvancedPage);

View File

@ -10,7 +10,8 @@ CConfigSettingSection::~CConfigSettingSection ()
{
for (size_t i = 0; i < m_Pages.size(); i++)
{
delete m_Pages[i];
CSettingsPage * Page = m_Pages[i];
delete Page;
}
m_Pages.clear();
}