aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parentdocs: Don't display any inheritance info if we do not inherit (diff)
downloadefl-1cab4721ae617d6368691637ec6fcf3899259aa7.tar.gz
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')
-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 2f3fa949de..518bfb2ac7 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)
static RGBA_Draw_Context *
_evas_common_draw_context_find(void)
{
- RGBA_Draw_Context *dc;
+ RGBA_Draw_Context *dc = NULL;
- if (!_ctxt_spares)
- {
- dc = malloc(sizeof(RGBA_Draw_Context));
- }
- else
+ if (_ctxt_spares)
{
SLKL(_ctx_spares_lock);
dc = eina_trash_pop(&_ctxt_spares);
@@ -121,6 +117,8 @@ _evas_common_draw_context_find(void)
SLKU(_ctx_spares_lock);
}
+ if (!dc) dc = malloc(sizeof(RGBA_Draw_Context));
+
return dc;
}