changeset 26987:1e5dde93eb26 stable

shading.m: Fix unexpected error when multiple hggroups present (bug #55993). * shading.m: If there are multiple parents then "get (parents, "children")" will return a cell array rather than an ordinary matrix. In such a case, convert cell array to column vector of graphics handles.
author Rik <rik@octave.org>
date Wed, 27 Mar 2019 11:55:50 -0700
parents 16d4e3d14213
children ce405303267c a7ad08ed3cb7
files scripts/plot/appearance/shading.m
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/shading.m	Wed Mar 27 11:15:37 2019 -0700
+++ b/scripts/plot/appearance/shading.m	Wed Mar 27 11:55:50 2019 -0700
@@ -77,11 +77,18 @@
         parents(end+1) = hglist(i);
       endif
     endfor
-    kids = get (parents, "children");
+    if (numel (parents) <= 1)
+      kids = get (parents, "children");
+    else
+      ## See bug #55993 where multiple hggroups caused failure.
+      kids = get (parents, "children");
+      kids = [kids{:}](:);  # convert cell array to column vector of handles
+    endif
+
   endwhile
 
-  ## FIXME: This is the old, simple code.
-  ##        Unfortunately, it also shades contour plots which is not desirable.
+  ## NOTE: This is the old, simple code.
+  ##       Unfortunately, it also shades contour plots which is not desirable.
   ##hp = findobj (hax, "type", "patch");
   ##hs = findobj (hax, "type", "surface");
   ##hlist = [hp(:); hs(:)];