Re: [PATCH 6/7] Present: Check for window/fence destroyed when idling pixmaps

2013-11-08 Thread Adam Jackson
On Thu, 2013-11-07 at 12:15 -0800, Keith Packard wrote:
> A client destroying objects in the middle of an unflip can end up
> having the screen flip window or fence set to NULL in the unflip
> notify path. Check for these and don't try to use those objects.
> 
> Signed-off-by: Keith Packard 

Reviewed-by: Adam Jackson 

- ajax

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 6/7] Present: Check for window/fence destroyed when idling pixmaps

2013-11-07 Thread Keith Packard
A client destroying objects in the middle of an unflip can end up
having the screen flip window or fence set to NULL in the unflip
notify path. Check for these and don't try to use those objects.

Signed-off-by: Keith Packard 
---
 present/present.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/present/present.c b/present/present.c
index 4c97ce4..fab105d 100644
--- a/present/present.c
+++ b/present/present.c
@@ -184,8 +184,10 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 
kind, CARD8 mode, uint64_
 static void
 present_pixmap_idle(PixmapPtr pixmap, WindowPtr window, CARD32 serial, struct 
present_fence *present_fence)
 {
-present_fence_set_triggered(present_fence);
-present_send_idle_notify(window, serial, pixmap, present_fence);
+if (present_fence)
+present_fence_set_triggered(present_fence);
+if (window)
+present_send_idle_notify(window, serial, pixmap, present_fence);
 }
 
 RRCrtcPtr
@@ -297,7 +299,8 @@ present_flip_idle(ScreenPtr screen)
 if (screen_priv->flip_pixmap) {
 present_pixmap_idle(screen_priv->flip_pixmap, screen_priv->flip_window,
 screen_priv->flip_serial, 
screen_priv->flip_idle_fence);
-present_fence_destroy(screen_priv->flip_idle_fence);
+if (screen_priv->flip_idle_fence)
+present_fence_destroy(screen_priv->flip_idle_fence);
 dixDestroyPixmap(screen_priv->flip_pixmap, 
screen_priv->flip_pixmap->drawable.id);
 screen_priv->flip_crtc = NULL;
 screen_priv->flip_window = NULL;
-- 
1.8.4.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel