devilhorns pushed a commit to branch master.

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

commit ef13b579484343e710212ec778733bb0a0ca79c4
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Fri Feb 12 08:26:27 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_damage.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/ecore_x/xlib/ecore_x_damage.c 
b/src/lib/ecore_x/xlib/ecore_x_damage.c
index 1134fae..c5906b4 100644
--- a/src/lib/ecore_x/xlib/ecore_x_damage.c
+++ b/src/lib/ecore_x/xlib/ecore_x_damage.c
@@ -42,6 +42,7 @@ ecore_x_damage_new(Ecore_X_Drawable d,
    Ecore_X_Damage damage;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
    damage = XDamageCreate(_ecore_x_disp, d, level);
    if (_ecore_xlib_sync) ecore_x_sync();
    return damage;
@@ -55,6 +56,7 @@ ecore_x_damage_free(Ecore_X_Damage damage)
 {
 #ifdef ECORE_XDAMAGE
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
    XDamageDestroy(_ecore_x_disp, damage);
 #endif /* ifdef ECORE_XDAMAGE */
 }
@@ -66,6 +68,7 @@ ecore_x_damage_subtract(Ecore_X_Damage damage,
 {
 #ifdef ECORE_XDAMAGE
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
    XDamageSubtract(_ecore_x_disp, damage, repair, parts);
    if (_ecore_xlib_sync) ecore_x_sync();
 #endif /* ifdef ECORE_XDAMAGE */

-- 


Reply via email to