diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-13 13:01:11 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-14 08:45:42 +0000 |
commit | bde8d341cc095a3877e4ecc80b02c267bb651d4b (patch) | |
tree | 4f07bcac22742f8ce19374c73ee40f6f84990a90 /src | |
parent | d5396ed00589374aed8e44f8f2e3217a3fb768df (diff) |
Don't suppress <log> tags with missing or bad expr
Rather, output an empty string as message in this case. Ignoring log
instructions is highly confusing.
Change-Id: Iebb30ffd3ade33f1277f3073f015127a99170e40
Task-number: QTBUG-71746
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/scxml/qscxmlexecutablecontent.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/scxml/qscxmlexecutablecontent.cpp b/src/scxml/qscxmlexecutablecontent.cpp index 206809c..45079d7 100644 --- a/src/scxml/qscxmlexecutablecontent.cpp +++ b/src/scxml/qscxmlexecutablecontent.cpp @@ -434,18 +434,20 @@ const InstructionId *QScxmlExecutionEngine::step(const InstructionId *ip, bool * qCDebug(qscxmlLog) << stateMachine << "Executing log step"; const Log *log = reinterpret_cast<const Log *>(instr); ip += log->size(); + QString str; if (log->expr != NoEvaluator) { - const QString str = dataModel->evaluateToString(log->expr, ok); - if (*ok) { - const QString label = tableData->string(log->label); - qCDebug(scxmlLog) << label << ":" << str; - QMetaObject::invokeMethod(stateMachine, - "log", - Qt::QueuedConnection, - Q_ARG(QString, label), - Q_ARG(QString, str)); - } + str = dataModel->evaluateToString(log->expr, ok); + if (!*ok) + qCWarning(qscxmlLog) << stateMachine << "Could not evaluate <log> expr to string."; } + + const QString label = tableData->string(log->label); + qCDebug(scxmlLog) << label << ":" << str; + QMetaObject::invokeMethod(stateMachine, + "log", + Qt::QueuedConnection, + Q_ARG(QString, label), + Q_ARG(QString, str)); return ip; } |