From f3a8c1848f7f2872e25e2786a8fa5e4fe40cda91 Mon Sep 17 00:00:00 2001 From: shermp <14854761+shermp@users.noreply.github.com> Date: Sun, 17 Oct 2021 17:02:52 +1300 Subject: [PATCH] Update dialog assert to not close dialogs in many cases --- src/ndb/NDBCfmDlg.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ndb/NDBCfmDlg.cc b/src/ndb/NDBCfmDlg.cc index 6de7af6..bfe8043 100644 --- a/src/ndb/NDBCfmDlg.cc +++ b/src/ndb/NDBCfmDlg.cc @@ -5,6 +5,11 @@ #include "NDBCfmDlg.h" #define DLG_ASSERT(ret, cond, str) if (!(cond)) { \ + errString = QString("%1: %2").arg(__func__).arg(str); \ + return (ret); \ +} + +#define DLG_ASSERT_CLOSE(ret, cond, str) if (!(cond)) { \ errString = QString("%1: %2").arg(__func__).arg(str); \ if (dlg) { \ connectStdSignals(); \ @@ -114,7 +119,7 @@ N3ConfirmationTextEditField* NDBCfmDlg::createTextEditField() { enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) { DLG_ASSERT(ForbiddenError, !dlg, "dialog already open"); - DLG_ASSERT( + DLG_ASSERT_CLOSE( SymbolError, symbols.ConfirmationDialogFactory_getConfirmationDialog && symbols.ConfirmationDialogFactory_showTextEditDialog && @@ -127,7 +132,7 @@ enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) { "could not find one or more standard dialog symbols" ); if (dlgType == TypeLineEdit) { - DLG_ASSERT( + DLG_ASSERT_CLOSE( SymbolError, (symbols.N3ConfirmationTextEditField__N3ConfirmationTextEditFieldKS || symbols.N3ConfirmationTextEditField__N3ConfirmationTextEditField) && @@ -139,18 +144,18 @@ enum Result NDBCfmDlg::createDialog(enum dialogType dlgType) { switch (dlgType) { case TypeStd: dlg = symbols.ConfirmationDialogFactory_getConfirmationDialog(nullptr); - DLG_ASSERT(NullError, dlg, "could not get confirmation dialog"); + DLG_ASSERT_CLOSE(NullError, dlg, "could not get confirmation dialog"); currActiveType = TypeStd; break; case TypeLineEdit: dlg = symbols.ConfirmationDialogFactory_showTextEditDialog(""); - DLG_ASSERT(NullError, dlg, "could not get line edit dialog"); + DLG_ASSERT_CLOSE(NullError, dlg, "could not get line edit dialog"); dlg->hide(); tef = createTextEditField(); - DLG_ASSERT(NullError, tef, "error getting text edit field"); + DLG_ASSERT_CLOSE(NullError, tef, "error getting text edit field"); tle = symbols.N3ConfirmationTextEditField__textEdit(tef); - DLG_ASSERT(NullError, tle, "error getting TouchLineEdit"); + DLG_ASSERT_CLOSE(NullError, tle, "error getting TouchLineEdit"); // Make the 'Go' key accept the dialog. if (!QObject::connect(tef, SIGNAL(commitRequested()), dlg, SIGNAL(accepted()))) { nh_log("unable to connect N3ConfirmationTextEditField::commitRequested() to ConfirmationDialog::accepted()");