[Hotfix][FancyZones] Unable to start correctly (#12038)

* fix event

* close handle on destroy
This commit is contained in:
Seraphima Zykova 2021-07-01 12:26:22 +03:00 committed by GitHub
parent 03eb9c3f5c
commit 086394d455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
{ {