Fixed crash when the config is switched to the variant.

This commit is contained in:
spx 2011-01-28 18:06:54 +00:00
parent 78db448471
commit fdae154245
3 changed files with 4 additions and 12 deletions

View File

@ -2228,7 +2228,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
else else
{ {
// Deactivate the existing config // Deactivate the existing config
DeactivateConfig((*iter).second, configIndex); DeactivateConfig((*iter).second, configIndex, false);
} }
} }
@ -2262,7 +2262,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
} }
} }
bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex) bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex, bool bLater)
{ {
if (configIndex >= 0 && configIndex < (int)m_ConfigStrings.size()) if (configIndex >= 0 && configIndex < (int)m_ConfigStrings.size())
{ {
@ -2287,7 +2287,7 @@ bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex)
// Disable the config in the ini-file // Disable the config in the ini-file
WriteActive(meterWindow->GetSkinName(), -1); WriteActive(meterWindow->GetSkinName(), -1);
return DeleteMeterWindow(meterWindow, true); return DeleteMeterWindow(meterWindow, bLater);
} }
return false; return false;
} }

View File

@ -180,7 +180,7 @@ public:
const std::vector<std::wstring>& GetAllThemes() { return m_Themes; } const std::vector<std::wstring>& GetAllThemes() { return m_Themes; }
void ActivateConfig(int configIndex, int iniIndex); void ActivateConfig(int configIndex, int iniIndex);
bool DeactivateConfig(CMeterWindow* meterWindow, int configIndex); bool DeactivateConfig(CMeterWindow* meterWindow, int configIndex, bool bLater = true);
const std::wstring& GetPath() { return m_Path; } const std::wstring& GetPath() { return m_Path; }
const std::wstring& GetIniFile() { return m_IniFile; } const std::wstring& GetIniFile() { return m_IniFile; }

View File

@ -511,14 +511,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
else else
{ {
if (configs[i].active != 0)
{
CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(configs[i].config);
if (meterWindow)
{
Rainmeter->DeactivateConfig(meterWindow, i);
}
}
Rainmeter->ActivateConfig(i, j); Rainmeter->ActivateConfig(i, j);
} }
return 0; return 0;