summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_draw_main.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-13 19:16:28 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-13 19:17:47 +0900
commit1cab4721ae617d6368691637ec6fcf3899259aa7 (patch)
tree48b7ad2fd74bcb9b538ff8c9f233586b44d81e7d /src/lib/evas/common/evas_draw_main.c
parente747e1ec2a4991ff53c854327ee66033686d7503 (diff)
evas: Fix potential crash with draw context
Using filters I end up in situations where this function returns NULL and all hell breaks loose. I guess the spinlock is what makes this possible (race condition). @fix
Diffstat (limited to 'src/lib/evas/common/evas_draw_main.c')
-rw-r--r--src/lib/evas/common/evas_draw_main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/evas/common/evas_draw_main.c b/src/lib/evas/common/evas_draw_main.c
index 2f3fa94..518bfb2 100644
--- a/src/lib/evas/common/evas_draw_main.c
+++ b/src/lib/evas/common/evas_draw_main.c
@@ -107,13 +107,9 @@ _evas_common_draw_context_stash(RGBA_Draw_Context *dc)
107static RGBA_Draw_Context * 107static RGBA_Draw_Context *
108_evas_common_draw_context_find(void) 108_evas_common_draw_context_find(void)
109{ 109{
110 RGBA_Draw_Context *dc; 110 RGBA_Draw_Context *dc = NULL;
111 111
112 if (!_ctxt_spares) 112 if (_ctxt_spares)
113 {
114 dc = malloc(sizeof(RGBA_Draw_Context));
115 }
116 else
117 { 113 {
118 SLKL(_ctx_spares_lock); 114 SLKL(_ctx_spares_lock);
119 dc = eina_trash_pop(&_ctxt_spares); 115 dc = eina_trash_pop(&_ctxt_spares);
@@ -121,6 +117,8 @@ _evas_common_draw_context_find(void)
121 SLKU(_ctx_spares_lock); 117 SLKU(_ctx_spares_lock);
122 } 118 }
123 119
120 if (!dc) dc = malloc(sizeof(RGBA_Draw_Context));
121
124 return dc; 122 return dc;
125} 123}
126 124