jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fc82281603e814368584c06cd6de22f4155e9d06
commit fc82281603e814368584c06cd6de22f4155e9d06 Author: Jean-Philippe Andre <[email protected]> Date: Wed Dec 13 19:16:28 2017 +0900 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 --- src/lib/evas/common/evas_draw_main.c | 10 ++++------ 1 file 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; } --
