changeset 24399:4fda27e1c909

maint: merge stable to default.
author Rik <rik@octave.org>
date Mon, 11 Dec 2017 14:47:25 -0800
parents 08f19fd144f4 (current diff) a7dfb685d261 (diff)
children 5cc1e8b16ab1
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Mon Dec 11 14:21:50 2017 -0500
+++ b/scripts/plot/appearance/legend.m	Mon Dec 11 14:47:25 2017 -0800
@@ -412,6 +412,10 @@
         endwhile
         if (k > 0)
           if (have_labels)
+            ## FIXME: This is inefficient on an existing legend object because
+            ##        it triggers the updateline() callback which then calls
+            ##        legend() itself.  Possibly better to delete the callback
+            ##        on displayname and then re-attach it.  See bug #52641.
             set (kids(k), "displayname", arg);
           endif
           hplots(end+1) = kids(k);
@@ -1182,7 +1186,11 @@
   if (update_name)
     ## When string changes, have to rebuild legend completely
     [hplots, text_strings] = __getlegenddata__ (hlegend);
-    legend (get (hplots(1), "parent"), hplots, text_strings);
+    ## FIXME: See bug #52641.  Changing an existing legend string to a blank
+    ##        can trigger this.
+    if (! isempty (hplots))
+      legend (get (hplots(1), "parent"), hplots, text_strings);
+    endif
   else
     kids = get (hlegend, "children");
     ll = lm = [];