discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6f4f0100d2ebea6d83edab9b4c90a06c98aaf84a

commit 6f4f0100d2ebea6d83edab9b4c90a06c98aaf84a
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Thu May 5 10:33:28 2016 -0400

    evas: add a few null checks for e->engine.data.output
    
    this can be null if engine info has not yet been set or if engine info
    has been unset, leading to engine crashes. instead of adding null checks in
    every engine, better to add the checks to the originating functions
    
    someone with time to kill should go through all the EAPI functions and
    add more checks
---
 src/lib/evas/canvas/evas_font_dir.c     | 13 ++++++++-----
 src/lib/evas/canvas/evas_object_image.c | 10 +++++++---
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/lib/evas/canvas/evas_font_dir.c 
b/src/lib/evas/canvas/evas_font_dir.c
index bfab21f..0f1c27c 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -1469,7 +1469,7 @@ _evas_canvas_font_hinting_get(Eo *eo_e EINA_UNUSED, 
Evas_Public_Data *e)
 EOLIAN Eina_Bool
 _evas_canvas_font_hinting_can_hint(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, 
Evas_Font_Hinting_Flags hinting)
 {
-   if (e->engine.func->font_hinting_can_hint)
+   if (e->engine.func->font_hinting_can_hint && e->engine.data.output)
      return e->engine.func->font_hinting_can_hint(e->engine.data.output,
                                                  hinting);
    else return EINA_FALSE;
@@ -1480,7 +1480,8 @@ _evas_canvas_font_cache_flush(Eo *eo_e EINA_UNUSED, 
Evas_Public_Data *e)
 {
    evas_canvas_async_block(e);
    evas_render_rendering_wait(e);
-   e->engine.func->font_cache_flush(e->engine.data.output);
+   if (e->engine.data.output)
+     e->engine.func->font_cache_flush(e->engine.data.output);
 }
 
 EOLIAN void
@@ -1489,14 +1490,16 @@ _evas_canvas_font_cache_set(Eo *eo_e EINA_UNUSED, 
Evas_Public_Data *e, int size)
    if (size < 0) size = 0;
    evas_canvas_async_block(e);
    evas_render_rendering_wait(e);
-   e->engine.func->font_cache_set(e->engine.data.output, size);
+   if (e->engine.data.output)
+     e->engine.func->font_cache_set(e->engine.data.output, size);
 }
 
 EOLIAN int
 _evas_canvas_font_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
 {
-   return e->engine.func->font_cache_get(e->engine.data.output);
-
+   if (e->engine.data.output)
+     return e->engine.func->font_cache_get(e->engine.data.output);
+   return -1;
 }
 
 EOLIAN Eina_List*
diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index 88fa6b1..5b309dd 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1119,7 +1119,8 @@ _evas_canvas_image_cache_flush(Eo *eo_e EINA_UNUSED, 
Evas_Public_Data *e)
 {
    evas_canvas_async_block(e);
    evas_render_rendering_wait(e);
-   e->engine.func->image_cache_flush(e->engine.data.output);
+   if (e->engine.data.output)
+     e->engine.func->image_cache_flush(e->engine.data.output);
 }
 
 EOLIAN void
@@ -1167,13 +1168,16 @@ _evas_canvas_image_cache_set(Eo *eo_e EINA_UNUSED, 
Evas_Public_Data *e, int size
    if (size < 0) size = 0;
    evas_canvas_async_block(e);
    evas_render_rendering_wait(e);
-   e->engine.func->image_cache_set(e->engine.data.output, size);
+   if (e->engine.data.output)
+     e->engine.func->image_cache_set(e->engine.data.output, size);
 }
 
 EOLIAN int
 _evas_canvas_image_cache_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
 {
-   return e->engine.func->image_cache_get(e->engine.data.output);
+   if (e->engine.data.output)
+     return e->engine.func->image_cache_get(e->engine.data.output);
+   return -1;
 }
 
 EOLIAN Eina_Bool

-- 


Reply via email to