devilhorns pushed a commit to branch master.

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

commit 3bc6a4bedf60ef644fffd7f48cbd77c476bdd2f0
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Fri Feb 12 08:27:35 2016 -0500

    ecore-x: Add EINA_SAFETY checks for missing display
    
    xlib immediately crashes upon being passed a null DISPLAY object,
    so every function in ecore-x should likely have safety checks such
    as these.
    
    @fix
    
    Signed-off-by: Chris Michael <cpmich...@osg.samsung.com>
---
 src/lib/ecore_x/xlib/ecore_x_drawable.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/ecore_x/xlib/ecore_x_drawable.c 
b/src/lib/ecore_x/xlib/ecore_x_drawable.c
index 1742c5b..e0edbe2 100644
--- a/src/lib/ecore_x/xlib/ecore_x_drawable.c
+++ b/src/lib/ecore_x/xlib/ecore_x_drawable.c
@@ -32,6 +32,7 @@ ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
    unsigned int ret_w, ret_h, dummy_border, dummy_depth;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
    if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y,
                      &ret_w, &ret_h, &dummy_border, &dummy_depth))
      {
@@ -69,6 +70,7 @@ ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
    unsigned int dummy_w, dummy_h, border_ret, dummy_depth;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
    if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
                      &dummy_w, &dummy_h, &border_ret, &dummy_depth))
      border_ret = 0;
@@ -90,6 +92,7 @@ ecore_x_drawable_depth_get(Ecore_X_Drawable d)
    unsigned int dummy_w, dummy_h, dummy_border, depth_ret;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
    if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
                      &dummy_w, &dummy_h, &dummy_border, &depth_ret))
      depth_ret = 0;
@@ -115,6 +118,7 @@ ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
                                 int height)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
    XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height);
    if (_ecore_xlib_sync) ecore_x_sync();
 }

-- 


Reply via email to