mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
The window deletion is now delayed when !RainmeterDeactivateConfig is used. This fixes the problem: Issue 116: Crash when skin tries to deactivate self by measure action.
This commit is contained in:
parent
a5b6d3a46e
commit
2c6c43c652
@ -2149,6 +2149,8 @@ LRESULT CMeterWindow::OnTimer(WPARAM wParam, LPARAM lParam)
|
||||
// MoveWindow(x, y);
|
||||
// }
|
||||
//}
|
||||
|
||||
Rainmeter->ClearDeleteLaterList();
|
||||
}
|
||||
else if(wParam == TRANSITIONTIMER)
|
||||
{
|
||||
|
@ -648,7 +648,7 @@ CRainmeter::~CRainmeter()
|
||||
|
||||
while (m_Meters.size() > 0)
|
||||
{
|
||||
DeleteMeterWindow((*m_Meters.begin()).second); // This removes the window from the vector
|
||||
DeleteMeterWindow((*m_Meters.begin()).second, false); // This removes the window from the vector
|
||||
}
|
||||
|
||||
if (m_TrayWindow) delete m_TrayWindow;
|
||||
@ -1203,7 +1203,7 @@ bool CRainmeter::DeactivateConfig(CMeterWindow* meterWindow, int configIndex)
|
||||
// Disable the config in the ini-file
|
||||
WritePrivateProfileString(meterWindow->GetSkinName().c_str(), L"Active", L"0", m_IniFile.c_str());
|
||||
|
||||
return DeleteMeterWindow(meterWindow);
|
||||
return DeleteMeterWindow(meterWindow, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1219,30 +1219,47 @@ void CRainmeter::CreateMeterWindow(std::wstring path, std::wstring config, std::
|
||||
}
|
||||
}
|
||||
|
||||
bool CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow)
|
||||
void CRainmeter::ClearDeleteLaterList()
|
||||
{
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
|
||||
|
||||
for (; iter != m_Meters.end(); iter++)
|
||||
while (!m_DelayDeleteList.empty())
|
||||
{
|
||||
DeleteMeterWindow(m_DelayDeleteList.front(), false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CRainmeter::DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater)
|
||||
{
|
||||
if (bLater)
|
||||
{
|
||||
m_DelayDeleteList.push_back(meterWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DelayDeleteList.remove(meterWindow); // Remove the window from the delete later list if it is there
|
||||
|
||||
std::map<std::wstring, CMeterWindow*>::iterator iter = m_Meters.begin();
|
||||
|
||||
for (; iter != m_Meters.end(); iter++)
|
||||
{
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
// Delete all meter windows
|
||||
delete (*iter).second;
|
||||
}
|
||||
else if ((*iter).second == meterWindow)
|
||||
{
|
||||
delete meterWindow;
|
||||
m_Meters.erase(iter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
// Delete all meter windows
|
||||
delete (*iter).second;
|
||||
}
|
||||
else if ((*iter).second == meterWindow)
|
||||
{
|
||||
delete meterWindow;
|
||||
m_Meters.erase(iter);
|
||||
return true;
|
||||
m_Meters.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (meterWindow == NULL)
|
||||
{
|
||||
m_Meters.clear();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -161,13 +161,15 @@ public:
|
||||
std::wstring ParseCommand(const WCHAR* command, CMeterWindow* meterWindow);
|
||||
void ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow);
|
||||
|
||||
void ClearDeleteLaterList();
|
||||
|
||||
static PLATFORM IsNT();
|
||||
static std::wstring ExtractPath(const std::wstring& strFilePath);
|
||||
static void ExpandEnvironmentVariables(std::wstring& strPath);
|
||||
|
||||
private:
|
||||
void CreateMeterWindow(std::wstring path, std::wstring config, std::wstring iniFile);
|
||||
bool DeleteMeterWindow(CMeterWindow* meterWindow);
|
||||
bool DeleteMeterWindow(CMeterWindow* meterWindow, bool bLater);
|
||||
void ScanForConfigs(std::wstring& path);
|
||||
void ScanForThemes(std::wstring& path);
|
||||
void ReadGeneralSettings(std::wstring& path);
|
||||
@ -219,6 +221,8 @@ private:
|
||||
|
||||
ULONG_PTR m_GDIplusToken;
|
||||
|
||||
std::list<CMeterWindow*> m_DelayDeleteList;
|
||||
|
||||
static bool c_DummyLitestep; // true, if not a Litestep plugin
|
||||
static std::wstring c_CmdLine; // The command line arguments
|
||||
static GlobalConfig c_GlobalConfig;
|
||||
|
@ -1,2 +1,2 @@
|
||||
#pragma once
|
||||
const int revision_number = 223;
|
||||
const int revision_number = 256;
|
Loading…
x
Reference in New Issue
Block a user