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 <cpmichael@osg.samsung.com>
This commit is contained in:
Chris Michael 2016-02-12 08:27:35 -05:00
parent ef13b57948
commit 3bc6a4bedf
1 changed files with 4 additions and 0 deletions

View File

@ -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();
}