From a459823bebbd9b7adba3829756612a2974113d34 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 22 Aug 2019 18:38:03 +0200 Subject: [PATCH] Make ui_canceller cover more code Signed-off-by: Simon Rozman --- lib/TTLS_UI/src/Module.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index 189af7b..eb17957 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -191,6 +191,7 @@ void eap::peer_ttls_ui::invoke_identity_ui( if (cfg.m_providers.size() > 1) { // Multiple identity providers: User has to select one first. wxEAPProviderSelectDialog dlg(cfg, init.m_parent); + ui_canceller lock(dlg.GetHWND()); // Centre and display dialog. dlg.Centre(wxBOTH); @@ -198,11 +199,8 @@ void eap::peer_ttls_ui::invoke_identity_ui( FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG }; ::FlashWindowEx(&fwi); } - { - ui_canceller lock(dlg.GetHWND()); - if (dlg.ShowModal() != wxID_OK) - throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); - } + if (dlg.ShowModal() != wxID_OK) + throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); cfg_prov = dlg.GetSelection(); assert(cfg_prov); @@ -251,6 +249,7 @@ void eap::peer_ttls_ui::invoke_identity_ui( { // Build dialog to prompt for outer credentials. wxEAPCredentialsDialog dlg(*cfg_prov, init.m_parent); + ui_canceller lock(dlg.GetHWND()); if (eap::config_method::status_cred_begin <= cfg_method->m_last_status && cfg_method->m_last_status < eap::config_method::status_cred_end) dlg.AddContent(new wxEAPCredentialWarningPanel(*cfg_prov, cfg_method->m_last_status, &dlg)); auto panel = new wxTLSCredentialsPanel(*cfg_prov, *cfg_method, *cred, &dlg, false); @@ -267,11 +266,8 @@ void eap::peer_ttls_ui::invoke_identity_ui( FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG }; ::FlashWindowEx(&fwi); } - { - ui_canceller lock(dlg.GetHWND()); - if (dlg.ShowModal() != wxID_OK) - throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); - } + if (dlg.ShowModal() != wxID_OK) + throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); if (panel->GetRemember()) { // Write credentials to credential manager. @@ -307,6 +303,7 @@ void eap::peer_ttls_ui::invoke_identity_ui( { // Native inner methods. Build dialog to prompt for inner credentials. wxEAPCredentialsDialog dlg(*cfg_prov, init.m_parent); + ui_canceller lock(dlg.GetHWND()); if (eap::config_method::status_cred_begin <= cfg_method->m_inner->m_last_status && cfg_method->m_inner->m_last_status < eap::config_method::status_cred_end) dlg.AddContent(new wxEAPCredentialWarningPanel(*cfg_prov, cfg_method->m_inner->m_last_status, &dlg)); wxEAPCredentialsPanelBase *panel = NULL; @@ -341,11 +338,8 @@ void eap::peer_ttls_ui::invoke_identity_ui( FLASHWINFO fwi = { sizeof(FLASHWINFO), dlg.GetHWND(), FLASHW_ALL | FLASHW_TIMERNOFG }; ::FlashWindowEx(&fwi); } - { - ui_canceller lock(dlg.GetHWND()); - if (dlg.ShowModal() != wxID_OK) - throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); - } + if (dlg.ShowModal() != wxID_OK) + throw win_runtime_error(ERROR_CANCELLED, __FUNCTION__ " Cancelled."); // Write credentials to credential manager. if (panel->GetRemember()) {