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;
|
CMeterWindow* mw = (CMeterWindow*)skin;
|
||||||
if (command)
|
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:
|
case BANG_REFRESH:
|
||||||
// Refresh needs to be delayed since it crashes if done during Update()
|
// 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;
|
break;
|
||||||
|
|
||||||
case BANG_REDRAW:
|
case BANG_REDRAW:
|
||||||
@ -4638,8 +4638,8 @@ LRESULT CALLBACK CMeterWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||||||
MESSAGE(OnMiddleButtonDoubleClick, WM_NCMBUTTONDBLCLK)
|
MESSAGE(OnMiddleButtonDoubleClick, WM_NCMBUTTONDBLCLK)
|
||||||
MESSAGE(OnWindowPosChanging, WM_WINDOWPOSCHANGING)
|
MESSAGE(OnWindowPosChanging, WM_WINDOWPOSCHANGING)
|
||||||
MESSAGE(OnCopyData, WM_COPYDATA)
|
MESSAGE(OnCopyData, WM_COPYDATA)
|
||||||
MESSAGE(OnDelayedRefresh, WM_DELAYED_REFRESH)
|
MESSAGE(OnDelayedRefresh, WM_METERWINDOW_DELAYED_REFRESH)
|
||||||
MESSAGE(OnDelayedMove, WM_DELAYED_MOVE)
|
MESSAGE(OnDelayedMove, WM_METERWINDOW_DELAYED_MOVE)
|
||||||
MESSAGE(OnDwmColorChange, WM_DWMCOLORIZATIONCOLORCHANGED)
|
MESSAGE(OnDwmColorChange, WM_DWMCOLORIZATIONCOLORCHANGED)
|
||||||
MESSAGE(OnDwmCompositionChange, WM_DWMCOMPOSITIONCHANGED)
|
MESSAGE(OnDwmCompositionChange, WM_DWMCOMPOSITIONCHANGED)
|
||||||
MESSAGE(OnSettingChange, WM_SETTINGCHANGE)
|
MESSAGE(OnSettingChange, WM_SETTINGCHANGE)
|
||||||
@ -4706,7 +4706,7 @@ LRESULT CMeterWindow::OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// With copy transparency we'll do a full refresh
|
// 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;
|
return 0;
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
#define REJECT_MESSAGE(msg) case msg: return 0;
|
#define REJECT_MESSAGE(msg) case msg: return 0;
|
||||||
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
#define END_MESSAGEPROC } return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||||
|
|
||||||
#define WM_DELAYED_REFRESH WM_APP + 1
|
#define WM_METERWINDOW_DELAYED_REFRESH WM_APP + 1
|
||||||
#define WM_DELAYED_MOVE WM_APP + 3
|
#define WM_METERWINDOW_DELAYED_MOVE WM_APP + 3
|
||||||
|
|
||||||
#define METERWINDOW_CLASS_NAME L"RainmeterMeterWindow"
|
#define METERWINDOW_CLASS_NAME L"RainmeterMeterWindow"
|
||||||
|
|
||||||
|
@ -1102,6 +1102,10 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_RAINMETER_EXECUTE:
|
||||||
|
Rainmeter->ExecuteCommand((const WCHAR*)lParam, (CMeterWindow*)wParam);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
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.
|
** Executes command when current processing is done.
|
||||||
**
|
**
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#define WM_RAINMETER_DELAYED_REFRESH_ALL WM_APP + 0
|
#define WM_RAINMETER_DELAYED_REFRESH_ALL WM_APP + 0
|
||||||
#define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1
|
#define WM_RAINMETER_DELAYED_EXECUTE WM_APP + 1
|
||||||
|
#define WM_RAINMETER_EXECUTE WM_APP + 2
|
||||||
|
|
||||||
struct GlobalConfig
|
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();
|
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
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;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user