Mercurial > octave
changeset 28810:90f7c563e706 stable
avoid infinite error loop in variable editor (bug #53858)
* variable-editor-model.cc (variable_editor_model::retrieve_variable):
Erorr if evaluation produces c-s list.
(base_ve_model::data, variable_editor_model::evaluation_error):
Update error message.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 28 Sep 2020 18:40:07 -0400 |
parents | f0588f913755 |
children | 8661ec211592 f864f78440e6 |
files | libgui/src/variable-editor-model.cc |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/variable-editor-model.cc Mon Sep 28 21:41:15 2020 +0200 +++ b/libgui/src/variable-editor-model.cc Mon Sep 28 18:40:07 2020 -0400 @@ -214,7 +214,7 @@ if (! m_valid) { if (role == Qt::DisplayRole) - return QVariant (QString ("Variable %1 not found") + return QVariant (QString ("Variable %1 not found or value can't be edited") .arg (QString::fromStdString (m_name))); return QVariant (QString ("x")); @@ -1215,7 +1215,13 @@ if (symbol_exist (name, "var") > 0) { int parse_status = 0; - return interp.eval_string (x, true, parse_status); + + octave_value result = interp.eval_string (x, true, parse_status); + + if (result.is_cs_list ()) + error ("evaluation produced c-s list"); + + return result; } return octave_value (); @@ -1225,7 +1231,7 @@ variable_editor_model::evaluation_error (const std::string& expr) const { emit user_error_signal ("Evaluation failed", - QString ("failed to evaluate expression: '%1'") + QString ("failed to evaluate expression: '%1' or result can't be edited") .arg (QString::fromStdString (expr))); }