fixed problem with window locks and AGG locks order - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2010年08月26日 00:17:54 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2010年08月26日 00:17:54 +0200
commitf462145565a4a97f749c08239767e98f4b1ba9ab (patch)
tree3dddc4b7a9979729b36c375b8a42bd0759e1ce95
parentd323e179f46d19488afa5001c1725d7e3268a806 (diff)
downloadgsl-shell-f462145565a4a97f749c08239767e98f4b1ba9ab.tar.gz
fixed problem with window locks and AGG locks order
Now we never perform a window lock from inside an AGG lock.
Diffstat
-rw-r--r--agg-plot/lua-plot.cpp 17
-rw-r--r--agg-plot/window-cpp.h 1
-rw-r--r--agg-plot/window.cpp 32
-rw-r--r--agg-plot/window.h 3
4 files changed, 19 insertions, 34 deletions
diff --git a/agg-plot/lua-plot.cpp b/agg-plot/lua-plot.cpp
index 4118843b..a86c1f54 100644
--- a/agg-plot/lua-plot.cpp
+++ b/agg-plot/lua-plot.cpp
@@ -127,10 +127,11 @@ plot_add_gener (lua_State *L, bool as_line)
AGG_LOCK();
p->self().add(obj, color, as_line);
- plot_update_raw (L, 1);
AGG_UNLOCK();
+ plot_update_raw (L, 1);
+
return 0;
}
@@ -158,9 +159,10 @@ plot_title_set (lua_State *L)
AGG_LOCK();
p->self().set_title(title);
- plot_update_raw (L, 1);
AGG_UNLOCK();
+
+ plot_update_raw (L, 1);
return 0;
}
@@ -194,10 +196,13 @@ plot_units_set (lua_State *L)
if (current != request)
{
plt.set_units(request);
+ AGG_UNLOCK();
plot_update_raw (L, 1);
}
-
- AGG_UNLOCK();
+ else
+ {
+ AGG_UNLOCK();
+ }
return 0;
}
@@ -232,16 +237,14 @@ plot_newindex (lua_State *L)
void
plot_update_raw (lua_State *L, int plot_index)
{
- window_plot_rev_lookup_apply (L, plot_index, window_slot_update_unprotected);
+ window_plot_rev_lookup_apply (L, plot_index, window_slot_update);
}
int
plot_update (lua_State *L)
{
lua_plot *p = lua_plot::check(L, 1);
- AGG_LOCK();
plot_update_raw (L, 1);
- AGG_UNLOCK();
return 0;
}
diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h
index efd157da..963d5a0d 100644
--- a/agg-plot/window-cpp.h
+++ b/agg-plot/window-cpp.h
@@ -67,6 +67,5 @@ public:
void draw_slot(int slot_id);
- void on_draw_unprotected();
virtual void on_draw();
};
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp
index 7c4f7edc..c45d3bc8 100644
--- a/agg-plot/window.cpp
+++ b/agg-plot/window.cpp
@@ -129,7 +129,9 @@ 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);
+ AGG_UNLOCK();
platform_support_update_region (this, r);
}
else
@@ -149,7 +151,7 @@ window::draw_slot(int slot_id, bool update_req)
}
void
-window::on_draw_unprotected()
+window::on_draw()
{
if (! m_canvas)
return;
@@ -158,14 +160,6 @@ window::on_draw_unprotected()
draw_rec(m_tree);
}
-void
-window::on_draw()
-{
- AGG_LOCK();
- on_draw_unprotected();
- AGG_UNLOCK();
-}
-
window *
window::check (lua_State *L, int index)
{
@@ -316,26 +310,16 @@ window_attach (lua_State *L)
}
int
-window_slot_update_unprotected (lua_State *L)
+window_slot_update (lua_State *L)
{
window *win = window::check (L, 1);
int slot_id = luaL_checkinteger (L, 2);
win->lock();
- win->draw_slot(slot_id, true);
- win->unlock();
-
- return 0;
-}
-
-int
-window_update_unprotected (lua_State *L)
-{
- window *win = window::check (L, 1);
-
- win->lock();
- win->on_draw_unprotected();
- win->update_window();
+ if (win->status == canvas_window::running)
+ {
+ win->draw_slot(slot_id, true);
+ }
win->unlock();
return 0;
diff --git a/agg-plot/window.h b/agg-plot/window.h
index 803aa3e1..c3a035c0 100644
--- a/agg-plot/window.h
+++ b/agg-plot/window.h
@@ -9,8 +9,7 @@ __BEGIN_DECLS
extern void window_register (lua_State *L);
-extern int window_slot_update_unprotected (lua_State *L);
-extern int window_update_unprotected (lua_State *L);
+extern int window_slot_update (lua_State *L);
extern int window_update (lua_State *L);
extern int window_new (lua_State *L);
extern int window_attach (lua_State *L);
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月18日 10:54:12 +0000

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