Mercurial > octave-nkf
changeset 19924:00c3f2021cad
use unwind_protect to restore static variable value (bug #44406)
* gl2ps-renderer.cc (glps_renderer::draw): Use unwind_protect to save
and restore value of static variable in_draw.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 02 Mar 2015 21:34:33 -0500 |
parents | e1d7bd38b82b |
children | a20f86786abb |
files | libinterp/corefcn/gl2ps-renderer.cc |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-renderer.cc Mon Mar 02 21:00:13 2015 -0500 +++ b/libinterp/corefcn/gl2ps-renderer.cc Mon Mar 02 21:34:33 2015 -0500 @@ -46,6 +46,10 @@ if (!in_draw) { + unwind_protect frame; + + frame.protect_var (in_draw); + in_draw = true; GLint buffsize = 0; @@ -108,7 +112,6 @@ buffsize, fp, include_graph.c_str ()); if (ret == GL2PS_ERROR) { - in_draw = 0; old_print_cmd.clear (); error ("gl2ps-renderer::draw: gl2psBeginPage returned GL2PS_ERROR"); return; @@ -127,7 +130,6 @@ } else if (state == GL2PS_ERROR) { - in_draw = 0; old_print_cmd.clear (); error ("gl2ps-renderer::draw: gl2psEndPage returned GL2PS_ERROR"); return; @@ -135,8 +137,6 @@ // Don't check state for GL2PS_UNINITIALIZED (should never happen) // GL2PS_OVERFLOW (see while loop) or GL2PS_SUCCESS } - - in_draw = 0; } else opengl_renderer::draw (go);