The deactivated window wasn't deleted properly (issue 117).

Deactivating a config kept it still activate in the rainmeter.ini file (issue 118).
This commit is contained in:
Kimmo Pekkola 2009-10-18 13:31:55 +00:00
parent 0ccc1e8388
commit b5042589cb
2 changed files with 20 additions and 4 deletions

View File

@ -141,6 +141,7 @@ public:
void MoveWindow(int x, int y);
void ChangeZPos(ZPOSITION zPos);
void FadeWindow(int from, int to);
Gdiplus::Bitmap* GetDoubleBuffer() { return m_DoubleBuffer; };
HWND GetWindow() { return m_Window; };
@ -222,7 +223,6 @@ private:
void ShowWindowIfAppropriate();
bool DoAction(int x, int y, MOUSE mouse, bool test);
bool ResizeWindow(bool reset);
void FadeWindow(int from, int to);
CConfigParser m_Parser;

View File

@ -1180,10 +1180,10 @@ void CRainmeter::ActivateConfig(int configIndex, int iniIndex)
{
m_ConfigStrings[configIndex].active = iniIndex + 1;
CreateMeterWindow(skinPath, skinConfig, skinIniFile);
wsprintf(buffer, L"%i", iniIndex + 1);
WritePrivateProfileString(skinConfig.c_str(), L"Active", buffer, m_IniFile.c_str());
CreateMeterWindow(skinPath, skinConfig, skinIniFile);
}
catch(CError& error)
{
@ -1232,7 +1232,22 @@ void CRainmeter::ClearDeleteLaterList()
{
while (!m_DelayDeleteList.empty())
{
DeleteMeterWindow(m_DelayDeleteList.front(), false);
CMeterWindow* meterWindow = m_DelayDeleteList.front();
delete meterWindow;
// Remove from the delete later list
m_DelayDeleteList.remove(meterWindow);
// Remove from the meter window list if it is still there
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
for (; iter != m_Meters.end(); iter++)
{
if ((*iter).second == meterWindow)
{
m_Meters.erase(iter);
break;
}
}
}
}
@ -1241,6 +1256,7 @@ bool CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater)
if (bLater)
{
m_DelayDeleteList.push_back(meterWindow);
meterWindow->FadeWindow(meterWindow->GetAlphaValue(), 0); // Fade out the window
}
else
{