mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed crash that could occur when using RmExecute from separate thread (in WebParser)
This commit is contained in:
parent
bb865ec514
commit
b60d7bdd90
@ -90,7 +90,8 @@ void __stdcall RmExecute(void* skin, LPCWSTR command)
|
||||
CMeterWindow* mw = (CMeterWindow*)skin;
|
||||
if (command)
|
||||
{
|
||||
Rainmeter->ExecuteCommand(command, mw);
|
||||
// WM_RAINMETER_EXECUTE used instead of ExecuteCommand for thread-safety
|
||||
SendMessage(Rainmeter->GetWindow(), WM_RAINMETER_EXECUTE, (WPARAM)mw, (LPARAM)command);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ void CMeterWindow::RunBang(BANGCOMMAND bang, const std::vector<std::wstring>& ar
|
||||
{
|
||||
case BANG_REFRESH:
|
||||
// Refresh needs to be delayed since it crashes if done during Update()
|
||||
PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
|
||||
PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
|
||||
break;
|
||||
|
||||
case BANG_REDRAW:
|
||||
@ -4638,8 +4638,8 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
||||
MESSAGE(OnMiddleButtonDoubleClick, WM_NCMBUTTONDBLCLK)
|
||||
MESSAGE(OnWindowPosChanging, WM_WINDOWPOSCHANGING)
|
||||
MESSAGE(OnCopyData, WM_COPYDATA)
|
||||
MESSAGE(OnDelayedRefresh, WM_DELAYED_REFRESH)
|
||||
MESSAGE(OnDelayedMove, WM_DELAYED_MOVE)
|
||||
MESSAGE(OnDelayedRefresh, WM_METERWINDOW_DELAYED_REFRESH)
|
||||
MESSAGE(OnDelayedMove, WM_METERWINDOW_DELAYED_MOVE)
|
||||
MESSAGE(OnDwmColorChange, WM_DWMCOLORIZATIONCOLORCHANGED)
|
||||
MESSAGE(OnDwmCompositionChange, WM_DWMCOMPOSITIONCHANGED)
|
||||
MESSAGE(OnSettingChange, WM_SETTINGCHANGE)
|
||||
@ -4706,7 +4706,7 @@ LRESULT CMeterWindow::OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
else
|
||||
{
|
||||
// With copy transparency we'll do a full refresh
|
||||
PostMessage(m_Window, WM_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
|
||||
PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -32,8 +32,8 @@
|
||||
#define REJECT_MESSAGE(msg) case msg: return 0;
|
||||
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
|
||||
#define WM_DELAYED_REFRESH WM_APP + 1
|
||||
#define WM_DELAYED_MOVE WM_APP + 3
|
||||
#define WM_METERWINDOW_DELAYED_REFRESH WM_APP + 1
|
||||
#define WM_METERWINDOW_DELAYED_MOVE WM_APP + 3
|
||||
|
||||
#define METERWINDOW_CLASS_NAME L"RainmeterMeterWindow"
|
||||
|
||||
|
@ -1102,6 +1102,10 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_RAINMETER_EXECUTE:
|
||||
Rainmeter->ExecuteCommand((const WCHAR*)lParam, (CMeterWindow*)wParam);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
@ -2090,7 +2094,6 @@ void CRainmeter::ExecuteCommand(const WCHAR* command, CMeterWindow* meterWindow)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Executes command when current processing is done.
|
||||
**
|
||||
|
@ -44,6 +44,7 @@
|
||||
|
||||
#define WM_RAINMETER_DELAYED_REFRESH_ALL WM_APP + 0
|
||||
#define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1
|
||||
#define WM_RAINMETER_EXECUTE WM_APP + 2
|
||||
|
||||
struct GlobalConfig
|
||||
{
|
||||
|
@ -1009,7 +1009,7 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
||||
{
|
||||
PostMessage((*iter).second->GetWindow(), WM_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
|
||||
PostMessage((*iter).second->GetWindow(), WM_METERWINDOW_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user