Mercurial > octave
changeset 24614:60d6914d801b stable
Don't create partially invalid graphic objects (bug #52904).
* graphics.cc (make_graphics_object): Wrap xset() call within try/catch block
in case additional arguments given to primitive object cause a failure. If
error caught, delete the partially formed object before issuing an error.
Also, correct function identified in error message to be "__go_%s__".
author | Rik <rik@octave.org> |
---|---|
date | Tue, 16 Jan 2018 11:46:27 -0800 |
parents | e2cf81bcdf01 |
children | 3daa67b7a243 c99163d188df |
files | libinterp/corefcn/graphics.cc |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc Tue Jan 16 17:21:21 2018 -0800 +++ b/libinterp/corefcn/graphics.cc Tue Jan 16 11:46:27 2018 -0800 @@ -10426,13 +10426,23 @@ } catch (octave::execution_exception& e) { - error (e, "__go%s__: unable to create graphics handle", + error (e, "__go_%s__: unable to create graphics handle", go_name.c_str ()); } adopt (parent, h); - xset (h, xargs); + try + { + xset (h, xargs); + } + catch (octave::execution_exception& e) + { + delete_graphics_object (h); + error (e, "__go_%s__: unable to create graphics handle", + go_name.c_str ()); + } + xcreatefcn (h); xinitialize (h);