discomfitor pushed a commit to branch master.

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

commit e07b04f88c1f312889c688fd79102eddbabcf4fc
Author: Yeongjong Lee <[email protected]>
Date:   Thu Aug 16 10:01:47 2018 -0400

    efl_ui_image: avoid a call to NULL
    
    Summary:
    Image object isn't created on constructor anymore. so that it need to check
    whether image object exist.
    
    Reviewers: Hermet, zmike
    
    Reviewed By: zmike
    
    Subscribers: cedric, #reviewers, #committers, zmike
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D6834
---
 src/lib/elementary/efl_ui_image.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/efl_ui_image.c 
b/src/lib/elementary/efl_ui_image.c
index 8398a47724..93664a254e 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -869,7 +869,7 @@ _efl_ui_image_efl_file_mmap_set(Eo *obj, Efl_Ui_Image_Data 
*sd,
    _async_cancel(sd);
 
    /* stop preloading as it may hit to-be-freed memory */
-   if (sd->preload_status == EFL_UI_IMAGE_PRELOADING)
+   if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING)
      evas_object_image_preload(sd->img, EINA_TRUE);
 
    if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd);
@@ -975,7 +975,7 @@ _efl_ui_image_remote_copier_done(void *data, const 
Efl_Event *event EINA_UNUSED)
    if (!sd->remote.copier) return;
 
    /* stop preloading as it may hit to-be-freed memory */
-   if (sd->preload_status == EFL_UI_IMAGE_PRELOADING)
+   if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING)
      evas_object_image_preload(sd->img, EINA_TRUE);
 
    if (sd->remote.binbuf) eina_binbuf_free(sd->remote.binbuf);
@@ -1114,7 +1114,7 @@ _efl_ui_image_efl_file_file_set(Eo *obj, 
Efl_Ui_Image_Data *sd, const char *file
    _async_cancel(sd);
 
    /* stop preloading as it may hit to-be-freed memory */
-   if (sd->preload_status == EFL_UI_IMAGE_PRELOADING)
+   if (sd->img && sd->preload_status == EFL_UI_IMAGE_PRELOADING)
      evas_object_image_preload(sd->img, EINA_TRUE);
 
    if (sd->remote.copier) _efl_ui_image_remote_copier_cancel(obj, sd);
@@ -1278,6 +1278,8 @@ EOLIAN static void
 _efl_ui_image_efl_gfx_image_load_controller_load_size_set(Eo *obj, 
Efl_Ui_Image_Data *sd, Eina_Size2D sz)
 {
    sd->load_size = sz;
+
+   if (!sd->img) return;
    _efl_ui_image_load_size_set_internal(obj, sd);
 }
 
@@ -1304,6 +1306,7 @@ _efl_ui_image_efl_orientation_orientation_set(Eo *obj, 
Efl_Ui_Image_Data *sd, Ef
    if (sd->edje) return;
    if (sd->orient == orient) return;
 
+   if (!sd->img) return;
    efl_orientation_set(sd->img, orient);
 
    sd->orient = orient;
@@ -1323,6 +1326,7 @@ _efl_ui_image_efl_orientation_flip_set(Eo *obj, 
Efl_Ui_Image_Data *sd, Efl_Flip
    if (sd->edje) return;
    if (sd->flip == flip) return;
 
+   if (!sd->img) return;
    efl_orientation_flip_set(sd->img, flip);
 
    sd->flip = flip;

-- 


Reply via email to