Mercurial > hg > octave-thorsten
changeset 14834:1230d5d58d2d
Fix segfault when replacing a colorbar axis. (Bug # 36576)
* scripts/plot/colorbar.m (resetaxis): Delete listener to axes "position"
property before reseting the position to its original state.
Simplify the code, and respect the original axes' units property.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 17 Jun 2012 19:17:26 -0400 (2012-06-17) |
parents | 0eb1b1eb2c76 |
children | 8e9f2cfa114d 466cb8673653 1d83d1539b2b |
files | scripts/plot/colorbar.m |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/colorbar.m +++ b/scripts/plot/colorbar.m @@ -162,7 +162,7 @@ "yliminclude", "off", "zliminclude", "off", "deletefcn", {@deletecolorbar, cax, obj}); - set (cax, "deletefcn", {@resetaxis, obj}); + set (cax, "deletefcn", {@resetaxis, ax, obj}); addlistener (ax, "clim", {@update_colorbar_clim, hi, vertical}); addlistener (ax, "plotboxaspectratio", {@update_colorbar_axis, cax, obj}); @@ -195,13 +195,15 @@ endif endfunction -function resetaxis (h, d, orig_props) - if (ishandle (h) && strcmp (get (h, "type"), "axes") - && (isempty (gcbf()) || strcmp (get (gcbf(), "beingdeleted"),"off")) - && ishandle (get (h, "axes"))) - set (get (h, "axes"), "position", orig_props.position, ... - "outerposition", orig_props.outerposition, ... - "activepositionproperty", orig_props.activepositionproperty); +function resetaxis (cax, d, ax, orig_props) + if (ishandle (ax) && strcmp (get (ax, "type"), "axes")) + dellistener (ax, "position") + units = get (ax, "units"); + set (ax, "units", orig_props.units) + set (ax, "position", orig_props.position, ... + "outerposition", orig_props.outerposition, ... + "activepositionproperty", orig_props.activepositionproperty); + set (ax, "units", units) endif endfunction