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 <cedric@osg.samsung.com>
This commit is contained in:
Youngbok Shin 2016-02-05 08:15:29 +01:00 committed by Cedric BAIL
parent 895ed5bde3
commit ff110f7867
1 changed files with 5 additions and 3 deletions

View File

@ -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