X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftext-interface.cc;h=232d9c3824a80bd36420c7c84dd9c07efd654ed8;hb=16e626a8524421eda692cb19be6d0ec5bff723b7;hp=5bd13641d737d3bb25dcd08cb6cc3d411a581b8b;hpb=25be0aa5e4481df77568b99357764f5b1ff46ceb;p=lilypond.git diff --git a/lily/text-interface.cc b/lily/text-interface.cc index 5bd13641d7..232d9c3824 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -28,6 +28,7 @@ #include "modified-font-metric.hh" #include "output-def.hh" #include "pango-font.hh" +#include "program-option.hh" #include "international.hh" #include "warn.hh" @@ -118,6 +119,19 @@ Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) } } + /* Check for non-terminating markups, e.g. recursive calls with + * changing arguments */ + SCM opt_depth = ly_get_option (ly_symbol2scm ("max-markup-depth")); + size_t max_depth = robust_scm2int(opt_depth, 1024); + if (depth > max_depth) + { + string name = ly_symbol2string (scm_procedure_name (func)); + // TODO: Also print the arguments of the markup! + non_fatal_error (_f("Markup depth exceeds maximal value of %d; " + "Markup: %s", max_depth, name.c_str ())); + return Stencil().smobbed_copy (); + } + encountered_markups.push_back (markup); SCM retval = scm_apply_2 (func, layout_smob, props, args); encountered_markups.pop_back ();