Hi,

for whatever reason the X11 backend of DirectFB is not able to use XShm
after an update of my graphics card driver (nvidia). I found that the
no-xshm code path crashes in dfb_x11_close_window(). The reason for this
is found in the XCreateImage() manual page:

  Note that when the image is created using XCreateImage, XGetImage, or
  XSubImage, the destroy procedure that the XDestroyImage function calls
  frees both the image structure and the data pointed to by the image
  structure.

The attached patch fixes this.


Sven


>From 39a121df36e97032429fa44f423e1d1a9afead86 Mon Sep 17 00:00:00 2001
From: Sven Neumann <s.neum...@phase-zero.de>
Date: Tue, 10 Mar 2009 19:07:18 +0100
Subject: [PATCH] avoid double free in the no_shm code path

---
 systems/x11/xwindow.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/systems/x11/xwindow.c b/systems/x11/xwindow.c
index 7b84383..2ae6311 100644
--- a/systems/x11/xwindow.c
+++ b/systems/x11/xwindow.c
@@ -276,15 +276,15 @@ dfb_x11_close_window( DFBX11 *x11, XWindow* xw )
           shmdt(xw->shmseginfo->shmaddr);
           shmctl(xw->shmseginfo->shmid,IPC_RMID,NULL);
           D_FREE(xw->shmseginfo);
+
+          XDestroyImage(xw->ximage);
      }
      else
           D_FREE( xw->virtualscreen );
 
-     XDestroyImage(xw->ximage);
-
      XFreeGC(xw->display,xw->gc);
      XDestroyWindow(xw->display,xw->window);
-	
+
      D_FREE(xw);
 }
 
-- 
1.6.2

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to