author | francesco-ST <francesco.abbate@st.com> | 2010年12月01日 18:02:37 +0100 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年12月01日 18:02:37 +0100 |
commit | 9a2e6443e486a5b417c7e0bfbcfef15ac9e0b6d8 (patch) | |
tree | 1596af5d11196151403c4a02aadb623495e265f9 /agg-plot/lua-plot.cpp | |
parent | 812299dcac716252de50f92dc389f6c87da0880f (diff) | |
download | gsl-shell-9a2e6443e486a5b417c7e0bfbcfef15ac9e0b6d8.tar.gz |
-rw-r--r-- | agg-plot/lua-plot.cpp | 25 |
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp index 12971bb7..6f036514 100644 --- a/agg-plot/lua-plot.cpp +++ b/agg-plot/lua-plot.cpp @@ -154,18 +154,29 @@ plot_add_gener (lua_State *L, bool as_line) lua_plot *p = object_check<lua_plot>(L, 1, GS_PLOT); agg::rgba8 color; - drawable *obj = parse_graph_args (L, color); - object_refs_add (L, table_plot_obj, p->current_layer_index(), 1, 2); + try { + drawable *obj = parse_graph_args (L, color); - AGG_LOCK(); + object_refs_add (L, table_plot_obj, p->current_layer_index(), 1, 2); - p->add(obj, color, as_line); + AGG_LOCK(); - AGG_UNLOCK(); + p->add(obj, color, as_line); - if (p->sync_mode()) - plot_flush (L); + AGG_UNLOCK(); + + if (p->sync_mode()) + plot_flush (L); + } + catch (std::bad_alloc&) + { + return luaL_error (L, OUT_OF_MEMORY_MSG); + } + catch (agg_spec_error& e) + { + return luaL_error (L, e.message()); + } return 0; } |