From 0ea57410a009b1f969ae0e64b5650ab231f42c8e Mon Sep 17 00:00:00 2001 From: spx Date: Tue, 10 Jul 2012 20:46:08 -0700 Subject: [PATCH] Fixed crash when reloading a non-existent skin http://rainmeter.net/forum/viewtopic.php?t=12704&p=71891 --- Library/Rainmeter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index ed8b59f1..6a62de6a 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -2433,8 +2433,6 @@ void CRainmeter::RefreshAll() CMeterWindow* mw = (*iter).second; if (mw) { - const WCHAR* skinFolder = mw->GetFolderPath().c_str(); - // Verify whether the cached information is valid int index = FindSkinFolderIndex(mw->GetFolderPath()); if (index != -1) @@ -2461,18 +2459,24 @@ void CRainmeter::RefreshAll() if (!found) { + const WCHAR* skinFolderPath = mw->GetFolderPath().c_str(); + std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolderPath, skinIniFile); + DeactivateSkin(mw, index); - std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, skinIniFile); ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); + continue; } } else { + const WCHAR* skinFolderPath = mw->GetFolderPath().c_str(); + std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolderPath, L""); + DeactivateSkin(mw, -2); // -2 = Force deactivate - std::wstring error = GetFormattedString(ID_STR_UNABLETOREFRESHSKIN, skinFolder, L""); ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); + continue; } try