cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=adc6e4e0da809c6cb5bf284b482260bdbd42dd25

commit adc6e4e0da809c6cb5bf284b482260bdbd42dd25
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Fri Feb 5 08:15:29 2016 +0100

    win: fix a possible crash in elm_win_add
    
    Summary:
    The enginelist[0] can be NULL in some very rare cases.
    Then enginelist[0] will be used for strcmp and it make a crash.
    @fix
    
    Test Plan: N/A
    
    Reviewers: raster, cedric, woohyun, jypark, jaehwan
    
    Differential Revision: https://phab.enlightenment.org/D3649
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/elm_win.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index a3d139e..24041a9 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -3514,7 +3514,8 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, 
const char *name, Elm_Win_
              if (_accel_is_gl())
                {
 // add all engines with selected engine first - if any
-                  enginelist[p++] = ENGINE_GET();
+                  if (ENGINE_GET())
+                    enginelist[p++] = ENGINE_GET();
 
 // add all engines with gl/accelerated ones first - only engines compiled
 #ifdef HAVE_ELEMENTARY_X
@@ -3558,8 +3559,9 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, 
const char *name, Elm_Win_
                   if (elm_config_preferred_engine_get())
                     enginelist[p++] = elm_config_preferred_engine_get();
 // add check _elm_gl_preference whether "none" or not
-                  else if (!elm_config_accel_preference_get() ||
-                           strcmp(elm_config_accel_preference_get(),"none"))
+                  else if (_elm_config->engine &&
+                           elm_config_accel_preference_get() &&
+                           !strcmp(elm_config_accel_preference_get(),"none"))
                     enginelist[p++] = _elm_config->engine;
 // add all engines with gl/accelerated ones first - only engines compiled
 #ifdef HAVE_ELEMENTARY_X

-- 


Reply via email to