Additional fix to 7849b2a

http://rainmeter.net/forum/viewtopic.php?f=14&t=16014
This commit is contained in:
spx 2013-07-09 21:59:37 +09:00
parent cd35729a17
commit ca787306b5
2 changed files with 8 additions and 1 deletions

View File

@ -177,6 +177,8 @@ MeterWindow::MeterWindow(const std::wstring& folderPath, const std::wstring& fil
*/
MeterWindow::~MeterWindow()
{
m_State = STATE_CLOSING;
if (!m_OnCloseAction.empty())
{
GetRainmeter().ExecuteCommand(m_OnCloseAction.c_str(), this);
@ -383,6 +385,7 @@ void MeterWindow::RemoveWindowExStyle(LONG_PTR flag)
*/
void MeterWindow::Deactivate()
{
if (m_State == STATE_CLOSING) return;
m_State = STATE_CLOSING;
GetRainmeter().RemoveMeterWindow(this);

View File

@ -417,6 +417,7 @@ void Rainmeter::Finalize()
DeleteAllUnmanagedMeterWindows();
DeleteAllMeterWindows();
DeleteAllUnmanagedMeterWindows(); // Redelete unmanaged windows caused by OnCloseAction
delete m_TrayWindow;
@ -981,10 +982,13 @@ void Rainmeter::DeleteAllMeterWindows()
while (it != m_MeterWindows.cend())
{
MeterWindow* mw = (*it).second;
m_MeterWindows.erase(it++); // Remove before deleting MeterWindow
m_MeterWindows.erase(it); // Remove before deleting MeterWindow
DialogManage::UpdateSkins(mw, true);
delete mw;
// Get next valid iterator (Fix for iterator invalidation caused by OnCloseAction)
it = m_MeterWindows.cbegin();
}
m_MeterWindows.clear();