!RainmeterRefresh and !RainmeterQuit are now handled only during the event loop since they can crash the application if executed during Update().

This commit is contained in:
Kimmo Pekkola 2009-08-19 17:57:09 +00:00
parent 77415cfc0f
commit 40f11d3934
3 changed files with 36 additions and 5 deletions

View File

@ -509,7 +509,8 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
switch(bang)
{
case BANG_REFRESH:
Refresh(false);
// Refresh needs to be delayed since it crashes if done during Update()
PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
break;
case BANG_REDRAW:
@ -670,8 +671,8 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const WCHAR* arg)
break;
case BANG_QUIT:
if (Rainmeter->GetDummyLitestep()) PostQuitMessage(0);
quitModule(Rainmeter->GetInstance());
// Quit needs to be delayed since it crashes if done during Update()
PostMessage(m_Window, WM_DELAYED_QUIT, (WPARAM)NULL, (LPARAM)NULL);
break;
}
}
@ -3088,6 +3089,8 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
MESSAGE(OnWindowPosChanging, WM_WINDOWPOSCHANGING)
MESSAGE(OnCopyData, WM_COPYDATA)
MESSAGE(OnDelayedExecute, WM_DELAYED_EXECUTE)
MESSAGE(OnDelayedRefresh, WM_DELAYED_REFRESH)
MESSAGE(OnDelayedQuit, WM_DELAYED_QUIT)
MESSAGE(OnSettingChange, WM_SETTINGCHANGE)
END_MESSAGEPROC
}
@ -3114,6 +3117,30 @@ LRESULT CMeterWindow::OnDelayedExecute(WPARAM wParam, LPARAM lParam)
return 0;
}
/*
** OnDelayedRefresh
**
** Handles delayed refresh
**
*/
LRESULT CMeterWindow::OnDelayedRefresh(WPARAM wParam, LPARAM lParam)
{
Refresh(false);
return 0;
}
/*
** OnDelayedQuit
**
** Handles delayed quit
**
*/
LRESULT CMeterWindow::OnDelayedQuit(WPARAM wParam, LPARAM lParam)
{
if (Rainmeter->GetDummyLitestep()) PostQuitMessage(0);
quitModule(Rainmeter->GetInstance());
return 0;
}
/*
** OnCopyData

View File

@ -34,7 +34,9 @@
#define REJECT_MESSAGE(msg) case msg: return 0;
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
#define WM_DELAYED_EXECUTE WM_APP
#define WM_DELAYED_EXECUTE WM_APP + 0
#define WM_DELAYED_REFRESH WM_APP + 1
#define WM_DELAYED_QUIT WM_APP + 2
enum MOUSE
{
@ -191,6 +193,8 @@ protected:
LRESULT OnLeftButtonUp(WPARAM wParam, LPARAM lParam);
LRESULT OnRightButtonUp(WPARAM wParam, LPARAM lParam);
LRESULT OnDelayedExecute(WPARAM wParam, LPARAM lParam);
LRESULT OnDelayedRefresh(WPARAM wParam, LPARAM lParam);
LRESULT OnDelayedQuit(WPARAM wParam, LPARAM lParam);
LRESULT OnSettingChange(WPARAM wParam, LPARAM lParam);

View File

@ -1,2 +1,2 @@
#pragma once
const int revision_number = 181;
const int revision_number = 185;