From 903a1ab9f682e7579f0c01b355096e9566aaa731 Mon Sep 17 00:00:00 2001 From: Eran Ifrah <eran@codelite.org> Date: Wed, 9 Mar 2022 09:32:25 +0200 Subject: [PATCH] fixed: https://github.com/eranif/codelite/issues/2965 --- LiteEditor/frame.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/LiteEditor/frame.cpp b/LiteEditor/frame.cpp index 2d2b690f32..c94706d100 100644 --- a/LiteEditor/frame.cpp +++ b/LiteEditor/frame.cpp @@ -2749,20 +2749,22 @@ void clMainFrame::OnExecuteNoDebug(wxCommandEvent& event) // Prepare the commands to execute QueueCommand commandExecute(QueueCommand::kExecuteNoDebug); - wxStandardID res = - ::PromptForYesNoDialogWithCheckbox(_("Would you like to build the active project\nbefore executing it?"), - "PromptForBuildBeforeExecute", _("Build and Execute"), _("Execute")); - // Don't do anything if "X" is pressed - if(res != wxID_CANCEL) { - if(res == wxID_YES) { - QueueCommand buildCommand(QueueCommand::kBuild); - ManagerST::Get()->PushQueueCommand(buildCommand); - commandExecute.SetCheckBuildSuccess(true); // execute only if build was successfull - } + wxStandardID res = ::PromptForYesNoCancelDialogWithCheckbox( + _("Would you like to build the active project\nbefore executing it?"), "PromptForBuildBeforeExecute", + _("Build and Execute"), _("Execute"), _("Cancel")); + if(res == wxID_CANCEL) { + return; + } - ManagerST::Get()->PushQueueCommand(commandExecute); - ManagerST::Get()->ProcessCommandQueue(); + // If "YES" is selected, push a build request to the queue + if(res == wxID_YES) { + QueueCommand buildCommand(QueueCommand::kBuild); + ManagerST::Get()->PushQueueCommand(buildCommand); + commandExecute.SetCheckBuildSuccess(true); // execute only if build was successfull } + + ManagerST::Get()->PushQueueCommand(commandExecute); + ManagerST::Get()->ProcessCommandQueue(); } void clMainFrame::OnExecuteNoDebugUI(wxUpdateUIEvent& event)