Add error handling for all possible failing of winrt::check_result (#8278)

This commit is contained in:
Mykhailo Pylyp
2020-12-01 12:03:24 +02:00
committed by GitHub
parent c6078e3136
commit d9ca68e6ea
2 changed files with 37 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include "common/start_visible.h"
#include "keyboard_state.h"
#include "common/shared_constants.h"
#include <common\logger\logger.h>
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
@@ -143,13 +144,36 @@ void TargetState::thread_proc()
handle_hidden();
break;
case Timeout:
handle_timeout();
try
{
handle_timeout();
}
catch (...)
{
Logger::critical("Timeout, handle_timeout failed.");
}
break;
case Shown:
handle_shown(false);
try
{
handle_shown(false);
}
catch (...)
{
Logger::critical("Shown, handle_shown failed.");
}
break;
case ForceShown:
handle_shown(true);
try
{
handle_shown(true);
}
catch (...)
{
Logger::critical("ForceShown, handle_shown failed.");
}
break;
case Exiting:
default: