forked from enlightenment/efl
ecore_wayland: Check for nulls before wayland calls
Summary: Wayland API routines by policy do not check input parameters for invalid values. In particular, many calls are wrappers through wl_proxy_marshal, which derefs its first argument without a check. So, for all wayland calls, always null check the first argument. Reviewers: zmike, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2211
This commit is contained in:
parent
931db7f12e
commit
daf10dd2ba
|
@ -71,8 +71,13 @@ _ecore_wl_subsurf_destroy(Ecore_Wl_Subsurf *ess)
|
||||||
{
|
{
|
||||||
Ecore_Wl_Window *parent;
|
Ecore_Wl_Window *parent;
|
||||||
|
|
||||||
wl_subsurface_destroy(ess->subsurface);
|
if (!ess) return;
|
||||||
wl_surface_destroy(ess->surface);
|
|
||||||
|
if (ess->subsurface)
|
||||||
|
wl_subsurface_destroy(ess->subsurface);
|
||||||
|
|
||||||
|
if (ess->surface)
|
||||||
|
wl_surface_destroy(ess->surface);
|
||||||
|
|
||||||
parent = ess->parent_win;
|
parent = ess->parent_win;
|
||||||
parent->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_remove
|
parent->subsurfs = (Ecore_Wl_Subsurf *)eina_inlist_remove
|
||||||
|
@ -120,6 +125,7 @@ ecore_wl_subsurf_position_set(Ecore_Wl_Subsurf *ess, int x, int y)
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
if (!ess) return;
|
if (!ess) return;
|
||||||
|
if (!ess->subsurface) return;
|
||||||
|
|
||||||
if ((x == ess->x) && (y == ess->y))
|
if ((x == ess->x) && (y == ess->y))
|
||||||
return;
|
return;
|
||||||
|
@ -148,6 +154,7 @@ ecore_wl_subsurf_place_above(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
|
||||||
|
|
||||||
if (!ess) return;
|
if (!ess) return;
|
||||||
if (!surface) return;
|
if (!surface) return;
|
||||||
|
if (!ess->subsurface) return;
|
||||||
|
|
||||||
wl_subsurface_place_above(ess->subsurface, surface);
|
wl_subsurface_place_above(ess->subsurface, surface);
|
||||||
}
|
}
|
||||||
|
@ -159,6 +166,7 @@ ecore_wl_subsurf_place_below(Ecore_Wl_Subsurf *ess, struct wl_surface *surface)
|
||||||
|
|
||||||
if (!ess) return;
|
if (!ess) return;
|
||||||
if (!surface) return;
|
if (!surface) return;
|
||||||
|
if (!ess->subsurface) return;
|
||||||
|
|
||||||
wl_subsurface_place_below(ess->subsurface, surface);
|
wl_subsurface_place_below(ess->subsurface, surface);
|
||||||
}
|
}
|
||||||
|
@ -169,6 +177,7 @@ ecore_wl_subsurf_sync_set(Ecore_Wl_Subsurf *ess, Eina_Bool val)
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
if (!ess) return;
|
if (!ess) return;
|
||||||
|
if (!ess->subsurface) return;
|
||||||
|
|
||||||
val = !!val;
|
val = !!val;
|
||||||
if (val == ess->sync) return;
|
if (val == ess->sync) return;
|
||||||
|
@ -189,10 +198,13 @@ ecore_wl_subsurf_opaque_region_set(Ecore_Wl_Subsurf *ess, int x, int y, int w, i
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
if (!ess) return;
|
if (!ess) return;
|
||||||
|
if (!ess->surface) return;
|
||||||
|
|
||||||
if ((w > 0) && (h > 0))
|
if ((w > 0) && (h > 0))
|
||||||
{
|
{
|
||||||
region = wl_compositor_create_region(_ecore_wl_compositor_get());
|
region = wl_compositor_create_region(_ecore_wl_compositor_get());
|
||||||
|
if (!region) return;
|
||||||
|
|
||||||
wl_region_add(region, x, y, w, h);
|
wl_region_add(region, x, y, w, h);
|
||||||
wl_surface_set_opaque_region(ess->surface, region);
|
wl_surface_set_opaque_region(ess->surface, region);
|
||||||
wl_region_destroy(region);
|
wl_region_destroy(region);
|
||||||
|
|
Loading…
Reference in New Issue