comparison scripts/plot/appearance/legend.m @ 33340:fa8a486773fd stable

legend.m: Fix error if root property "showhiddenhandles" is "on" (bug #65442) * legend.m: At start of function, check root property "showhiddenhandles". If set to "on", then turn it "off". Create an onCleanup action to restore the setting at the end of the function.
author Rik <rik@octave.org>
date Fri, 05 Apr 2024 17:18:12 -0700
parents 2e484f9f1f18
children 54d87fbbb421
comparison
equal deleted inserted replaced
33337:35ac89ffcf7c 33340:fa8a486773fd
204 endif 204 endif
205 205
206 ## FIXME: This function needs to be locked to avoid bug #59439. Remove this 206 ## FIXME: This function needs to be locked to avoid bug #59439. Remove this
207 ## lock once that bug is properly fixed. 207 ## lock once that bug is properly fixed.
208 mlock (); 208 mlock ();
209
210 ## legend() requires root property to be invisible.
211 if (strcmp (get (groot, 'showhiddenhandles'), 'on'))
212 cleanup = onCleanup (@() set (groot, 'showhiddenhandles', 'on'));
213 set (groot, 'showhiddenhandles', 'off');
214 endif
209 215
210 opts = parse_opts (varargin{:}); 216 opts = parse_opts (varargin{:});
211 217
212 hl = opts.legend_handle; 218 hl = opts.legend_handle;
213 219