mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-19 23:24:08 +08:00
Add error handling for all possible failing of winrt::check_result (#8278)
This commit is contained in:
parent
c6078e3136
commit
d9ca68e6ea
@ -233,7 +233,16 @@ void OverlayWindow::enable()
|
|||||||
winkey_popup->apply_overlay_opacity(((float)overlayOpacity.value) / 100.0f);
|
winkey_popup->apply_overlay_opacity(((float)overlayOpacity.value) / 100.0f);
|
||||||
winkey_popup->set_theme(theme.value);
|
winkey_popup->set_theme(theme.value);
|
||||||
target_state = std::make_unique<TargetState>(pressTime.value);
|
target_state = std::make_unique<TargetState>(pressTime.value);
|
||||||
winkey_popup->initialize();
|
try
|
||||||
|
{
|
||||||
|
winkey_popup->initialize();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
Logger::critical("Winkey popup failed to initialize");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(DISABLE_LOWLEVEL_HOOKS_WHEN_DEBUGGED)
|
#if defined(DISABLE_LOWLEVEL_HOOKS_WHEN_DEBUGGED)
|
||||||
const bool hook_disabled = IsDebuggerPresent();
|
const bool hook_disabled = IsDebuggerPresent();
|
||||||
#else
|
#else
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "common/start_visible.h"
|
#include "common/start_visible.h"
|
||||||
#include "keyboard_state.h"
|
#include "keyboard_state.h"
|
||||||
#include "common/shared_constants.h"
|
#include "common/shared_constants.h"
|
||||||
|
#include <common\logger\logger.h>
|
||||||
|
|
||||||
TargetState::TargetState(int ms_delay) :
|
TargetState::TargetState(int ms_delay) :
|
||||||
// TODO: All this processing should be done w/o a separate thread etc. in pre_wnd_proc of winkey_popup to avoid
|
// TODO: All this processing should be done w/o a separate thread etc. in pre_wnd_proc of winkey_popup to avoid
|
||||||
@ -143,13 +144,36 @@ void TargetState::thread_proc()
|
|||||||
handle_hidden();
|
handle_hidden();
|
||||||
break;
|
break;
|
||||||
case Timeout:
|
case Timeout:
|
||||||
handle_timeout();
|
try
|
||||||
|
{
|
||||||
|
handle_timeout();
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
Logger::critical("Timeout, handle_timeout failed.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Shown:
|
case Shown:
|
||||||
handle_shown(false);
|
try
|
||||||
|
{
|
||||||
|
handle_shown(false);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
Logger::critical("Shown, handle_shown failed.");
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ForceShown:
|
case ForceShown:
|
||||||
handle_shown(true);
|
try
|
||||||
|
{
|
||||||
|
handle_shown(true);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
Logger::critical("ForceShown, handle_shown failed.");
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Exiting:
|
case Exiting:
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user