mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
[Hotfix][FancyZones] Unable to start correctly (#12038)
* fix event * close handle on destroy
This commit is contained in:
parent
03eb9c3f5c
commit
086394d455
@ -98,6 +98,13 @@ public:
|
|||||||
virtual void destroy() override
|
virtual void destroy() override
|
||||||
{
|
{
|
||||||
Disable(false);
|
Disable(false);
|
||||||
|
|
||||||
|
if (m_toggleEditorEvent)
|
||||||
|
{
|
||||||
|
CloseHandle(m_toggleEditorEvent);
|
||||||
|
m_toggleEditorEvent = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +121,15 @@ public:
|
|||||||
m_settings = MakeFancyZonesSettings(reinterpret_cast<HINSTANCE>(&__ImageBase), FancyZonesModuleInterface::get_name(), FancyZonesModuleInterface::get_key());
|
m_settings = MakeFancyZonesSettings(reinterpret_cast<HINSTANCE>(&__ImageBase), FancyZonesModuleInterface::get_name(), FancyZonesModuleInterface::get_key());
|
||||||
|
|
||||||
m_toggleEditorEvent = CreateDefaultEvent(CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT);
|
m_toggleEditorEvent = CreateDefaultEvent(CommonSharedConstants::FANCY_ZONES_EDITOR_TOGGLE_EVENT);
|
||||||
|
if (!m_toggleEditorEvent)
|
||||||
|
{
|
||||||
|
Logger::error(L"Failed to create toggle editor event");
|
||||||
|
auto message = get_last_error_message(GetLastError());
|
||||||
|
if (message.has_value())
|
||||||
|
{
|
||||||
|
Logger::error(message.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -158,8 +174,10 @@ private:
|
|||||||
Trace::FancyZones::EnableFancyZones(false);
|
Trace::FancyZones::EnableFancyZones(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetEvent(m_toggleEditorEvent);
|
if (m_toggleEditorEvent)
|
||||||
CloseHandle(m_toggleEditorEvent);
|
{
|
||||||
|
ResetEvent(m_toggleEditorEvent);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_hProcess)
|
if (m_hProcess)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user