From fdae15424539fae11cfc0e11669c9f12f926a279 Mon Sep 17 00:00:00 2001 From: spx Date: Fri, 28 Jan 2011 18:06:54 +0000 Subject: [PATCH] Fixed crash when the config is switched to the variant. --- Library/Rainmeter.cpp | 6 +++--- Library/Rainmeter.h | 2 +- Library/TrayWindow.cpp | 8 -------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 70942590..d4a51612 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -2228,7 +2228,7 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex) else { // 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()) { @@ -2287,7 +2287,7 @@ bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex) // Disable the config in the ini-file WriteActive(meterWindow->GetSkinName(), -1); - return DeleteMeterWindow(meterWindow, true); + return DeleteMeterWindow(meterWindow, bLater); } return false; } diff --git a/Library/Rainmeter.h b/Library/Rainmeter.h index ef6fee96..95470918 100644 --- a/Library/Rainmeter.h +++ b/Library/Rainmeter.h @@ -180,7 +180,7 @@ public: const std::vector& GetAllThemes() { return m_Themes; } 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& GetIniFile() { return m_IniFile; } diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index ec332352..5ccd0045 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -511,14 +511,6 @@ LRESULT CALLBACK CTrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA } else { - if (configs[i].active != 0) - { - CMeterWindow* meterWindow = Rainmeter->GetMeterWindow(configs[i].config); - if (meterWindow) - { - Rainmeter->DeactivateConfig(meterWindow, i); - } - } Rainmeter->ActivateConfig(i, j); } return 0;