mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fix crash when actions are executed by plugin threads after skin unload
This commit is contained in:
parent
b7c1e16554
commit
9bf5871abf
@ -4677,19 +4677,7 @@ LRESULT CMeterWindow::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
if (pCopyDataStruct && (pCopyDataStruct->dwData == 1) && (pCopyDataStruct->cbData > 0))
|
if (pCopyDataStruct && (pCopyDataStruct->dwData == 1) && (pCopyDataStruct->cbData > 0))
|
||||||
{
|
{
|
||||||
// Check that we're still alive
|
if (Rainmeter->HasMeterWindow(this))
|
||||||
bool found = false;
|
|
||||||
std::map<std::wstring, CMeterWindow*>::const_iterator iter = Rainmeter->GetAllMeterWindows().begin();
|
|
||||||
for ( ; iter != Rainmeter->GetAllMeterWindows().end(); ++iter)
|
|
||||||
{
|
|
||||||
if ((*iter).second == this)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found)
|
|
||||||
{
|
{
|
||||||
const WCHAR* command = (const WCHAR*)pCopyDataStruct->lpData;
|
const WCHAR* command = (const WCHAR*)pCopyDataStruct->lpData;
|
||||||
Rainmeter->ExecuteCommand(command, this);
|
Rainmeter->ExecuteCommand(command, this);
|
||||||
|
@ -1172,7 +1172,10 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_RAINMETER_EXECUTE:
|
case WM_RAINMETER_EXECUTE:
|
||||||
|
if (Rainmeter->HasMeterWindow((CMeterWindow*)wParam))
|
||||||
|
{
|
||||||
Rainmeter->ExecuteCommand((const WCHAR*)lParam, (CMeterWindow*)wParam);
|
Rainmeter->ExecuteCommand((const WCHAR*)lParam, (CMeterWindow*)wParam);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1598,6 +1601,19 @@ void CRainmeter::RemoveUnmanagedMeterWindow(CMeterWindow* meterWindow)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CRainmeter::HasMeterWindow(const CMeterWindow* meterWindow) const
|
||||||
|
{
|
||||||
|
for (auto it = m_MeterWindows.begin(); it != m_MeterWindows.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((*it).second == meterWindow)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& folderPath)
|
CMeterWindow* CRainmeter::GetMeterWindow(const std::wstring& folderPath)
|
||||||
{
|
{
|
||||||
const WCHAR* folderSz = folderPath.c_str();
|
const WCHAR* folderSz = folderPath.c_str();
|
||||||
|
@ -110,6 +110,8 @@ public:
|
|||||||
|
|
||||||
CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
CTrayWindow* GetTrayWindow() { return m_TrayWindow; }
|
||||||
|
|
||||||
|
bool HasMeterWindow(const CMeterWindow* meterWindow) const;
|
||||||
|
|
||||||
CMeterWindow* GetMeterWindow(const std::wstring& folderPath);
|
CMeterWindow* GetMeterWindow(const std::wstring& folderPath);
|
||||||
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
CMeterWindow* GetMeterWindowByINI(const std::wstring& ini_searching);
|
||||||
std::pair<int, int> GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file);
|
std::pair<int, int> GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file);
|
||||||
|
Loading…
Reference in New Issue
Block a user