Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > e265b08b6bebf8514a189c80db57a2d3 > files > 56

x11-server-1.3.0.0-25.1mdv2008.0.src.rpm

--- xorg-server-1.3.0.0/hw/xfree86/modes/xf86RandR12.c.orig	2007-08-03 10:53:11.000000000 -0300
+++ xorg-server-1.3.0.0/hw/xfree86/modes/xf86RandR12.c	2007-08-03 10:53:43.000000000 -0300
@@ -339,6 +339,9 @@ xf86RandR12ScreenSetSize (ScreenPtr	pScr
     WindowPtr		pRoot = WindowTable[pScreen->myNum];
     Bool		ret = FALSE;
 
+    if (!pScrn->vtSema)
+	return FALSE;
+
     if (randrp->virtualX == -1 || randrp->virtualY == -1)
     {
 	randrp->virtualX = pScrn->virtualX;
--- xorg-server-1.3.0.0/hw/xfree86/modes/xf86Cursors.c.orig	2007-08-03 10:53:59.000000000 -0300
+++ xorg-server-1.3.0.0/hw/xfree86/modes/xf86Cursors.c	2007-08-03 10:59:36.000000000 -0300
@@ -47,6 +47,21 @@
 #include "cursorstr.h"
 
 /*
+ * This function tries to make sure the driver/server code will not
+ * used memory no longer pointing to cursor data by updating the
+ * cursor reference counter accordingly.
+ */
+static void
+xf86_config_set_cursor(xf86CrtcConfigPtr xf86_config, CursorPtr cursor)
+{
+    if (xf86_config->cursor)
+	--xf86_config->cursor->refcnt;
+    xf86_config->cursor = cursor;
+    if (cursor)
+	++xf86_config->cursor->refcnt;
+}
+
+/*
  * Given a screen coordinate, rotate back to a cursor source coordinate
  */
 static void
@@ -419,7 +434,7 @@ xf86_use_hw_cursor (ScreenPtr screen, Cu
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
 
-    xf86_config->cursor = cursor;
+    xf86_config_set_cursor(xf86_config, cursor);
     
     if (cursor->bits->width > cursor_info->MaxWidth ||
 	cursor->bits->height> cursor_info->MaxHeight)
@@ -435,7 +450,7 @@ xf86_use_hw_cursor_argb (ScreenPtr scree
     xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
     xf86CursorInfoPtr	cursor_info = xf86_config->cursor_info;
     
-    xf86_config->cursor = cursor;
+    xf86_config_set_cursor(xf86_config, cursor);
     
     /* Make sure ARGB support is available */
     if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
@@ -533,7 +548,7 @@ xf86_cursors_init (ScreenPtr screen, int
     }
 #endif
     
-    xf86_config->cursor = NULL;
+    xf86_config_set_cursor(xf86_config, NULL);
     xf86_hide_cursors (scrn);
     
     return xf86InitCursor (screen, cursor_info);