ecore_drm2: Add checks for using a plane after death

We keep planes on the plane list to ensure a released plane is removed
from display - however this means that if a caller starts messing with
a plane after release, that it could potentially reposition a plane it
doesn't own anymore.

Use EINA_SAFETY macros to prevent this.
This commit is contained in:
Derek Foreman 2017-05-05 10:52:05 -05:00
parent c722466a60
commit 18af247ab2
1 changed files with 3 additions and 0 deletions

View File

@ -129,6 +129,7 @@ EAPI void
ecore_drm2_plane_release(Ecore_Drm2_Plane *plane)
{
EINA_SAFETY_ON_NULL_RETURN(plane);
EINA_SAFETY_ON_TRUE_RETURN(plane->dead);
plane->dead = EINA_TRUE;
plane->state->in_use = EINA_FALSE;
@ -139,6 +140,7 @@ EAPI void
ecore_drm2_plane_destination_set(Ecore_Drm2_Plane *plane, int x, int y, int w, int h)
{
EINA_SAFETY_ON_NULL_RETURN(plane);
EINA_SAFETY_ON_TRUE_RETURN(plane->dead);
plane->state->cx.value = x;
plane->state->cy.value = y;
@ -155,6 +157,7 @@ ecore_drm2_plane_fb_set(Ecore_Drm2_Plane *plane, Ecore_Drm2_Fb *fb)
EINA_SAFETY_ON_NULL_RETURN_VAL(plane, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(plane->dead, EINA_FALSE);
fallback_id = plane->state->fid.value;
plane->state->fid.value = fb->id;