Sophie

Sophie

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

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

--- xorg-server-1.3.0.0/dix/cursor.c.orig	2007-08-03 11:20:56.000000000 -0300
+++ xorg-server-1.3.0.0/dix/cursor.c	2007-08-03 11:05:43.000000000 -0300
@@ -74,6 +74,60 @@ static GlyphSharePtr sharedGlyphs = (Gly
 static CARD32	cursorSerial;
 #endif
 
+#if 0
+struct CursorDebug {
+    CursorPtr cursor;
+    struct CursorDebug *next;
+};
+static int cursor_count;
+static struct CursorDebug *cursor_debug;
+static void debug_add(CursorPtr cursor)
+{
+    struct CursorDebug *ptr = cursor_debug;
+
+    if (cursor == NULL)
+	return;
+    if (ptr) {
+	for (; ptr->next; ptr = ptr->next)
+	    if (ptr->cursor == cursor)
+		return;
+	ptr->next = xalloc(sizeof(struct CursorDebug));
+	ptr = ptr->next;
+     }
+    else {
+	cursor_debug = xalloc(sizeof(struct CursorDebug));
+	ptr = cursor_debug;
+    }
+    ptr->cursor = cursor;
+    ptr->next = NULL;
+    ++cursor_count;
+    ErrorF("*** New Cursor %p (%d cursors)\n", cursor, cursor_count);
+}
+static void debug_rem(CursorPtr cursor)
+{
+    struct CursorDebug *ptr = cursor_debug;
+    struct CursorDebug *prev = ptr;
+
+    if (cursor == NULL)
+	return;
+    if (ptr) {
+	for (ptr = ptr->next; ptr; prev = ptr, ptr = ptr->next)
+	    if (ptr->cursor == cursor)
+		break;
+    }
+    if (ptr == NULL)
+	ErrorF("*** Cursor %p allocated elsewhere or bogus pointer?\n", cursor);
+    else {
+	prev->next = ptr->next;
+	xfree(ptr);
+	if (ptr == cursor_debug)
+	    cursor_debug = NULL;
+	--cursor_count;
+	ErrorF("*** Del Cursor %p (%d cursors)\n", cursor, cursor_count);
+    }
+}
+#endif /* 0 */
+
 static void
 FreeCursorBits(CursorBitsPtr bits)
 {
@@ -124,6 +178,9 @@ FreeCursor(pointer value, XID cid)
 	(void)( *pscr->UnrealizeCursor)( pscr, pCurs);
     }
     FreeCursorBits(pCurs->bits);
+#if 0
+    debug_rem(pCurs);
+#endif
     xfree( pCurs);
     return(Success);
 }
@@ -225,6 +282,9 @@ AllocCursorARGB(unsigned char *psrcbits,
 	    return (CursorPtr)NULL;
 	}
     }
+#if 0
+    debug_add(pCurs);
+#endif
     return pCurs;
 }