added try block to catch bad_alloc - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/window.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2010年09月01日 22:33:41 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2010年09月01日 22:33:41 +0200
commitc90c96810389377d6f89d6709bfdcf68ecf42e94 (patch)
tree2059462db8a3772d8ae35270981ad23ec304db92 /agg-plot/window.cpp
parent4806d8bdb82b3c6a221caa3d73d7541c5721a530 (diff)
downloadgsl-shell-c90c96810389377d6f89d6709bfdcf68ecf42e94.tar.gz
added try block to catch bad_alloc
Added try block in window draw routine by respecting the locks. Fixed unchecked memory allocation in XWindow put_image platform_support procedure. The code was tested with valgrind and ulimit on VM. The code still contain DEBUG code that should be eliminated.
Diffstat (limited to 'agg-plot/window.cpp')
-rw-r--r--agg-plot/window.cpp 6
1 files changed, 5 insertions, 1 deletions
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp
index 00372b65..b107af10 100644
--- a/agg-plot/window.cpp
+++ b/agg-plot/window.cpp
@@ -130,7 +130,11 @@ void window::draw_slot_by_ref(window::ref& ref, bool dirty)
agg::rect_base<int> r = rect_of_slot_matrix(mtx);
m_canvas->clear_box(r);
AGG_LOCK();
- ref.plot->draw(*m_canvas, mtx);
+ try
+ {
+ ref.plot->draw(*m_canvas, mtx);
+ }
+ catch (std::bad_alloc&) { }
AGG_UNLOCK();
platform_support_update_region (this, r);
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月12日 23:16:33 +0000

AltStyle によって変換されたページ (->オリジナル) /