[Xquartz-changes] [173] AppleSGLX/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Feb 18 21:22:57 PST 2009
Revision: 173
http://trac.macosforge.org/projects/xquartz/changeset/173
Author: gstaplin at apple.com
Date: 2009-02-18 21:22:57 -0800 (Wed, 18 Feb 2009)
Log Message:
-----------
Rename the drawables global list to drawables_list.
Add apple_glx_get_drawable_count() for use with debugging a resource leak.
Modified Paths:
--------------
AppleSGLX/trunk/apple_glx_drawable.c
AppleSGLX/trunk/apple_glx_drawable.h
Modified: AppleSGLX/trunk/apple_glx_drawable.c
===================================================================
--- AppleSGLX/trunk/apple_glx_drawable.c 2009-02-19 05:08:28 UTC (rev 172)
+++ AppleSGLX/trunk/apple_glx_drawable.c 2009-02-19 05:22:57 UTC (rev 173)
@@ -39,7 +39,7 @@
#include "appledri.h"
static pthread_mutex_t drawables_lock = PTHREAD_MUTEX_INITIALIZER;
-static struct apple_glx_drawable *drawables = NULL;
+static struct apple_glx_drawable *drawables_list = NULL;
static void lock_drawables_list(void) {
int err;
@@ -75,7 +75,7 @@
* Pixmaps aren't required to have a globally unique ID from what I recall.
* so we use the display connection with the drawable lookup.
*/
- for(i = drawables; i; i = i->next) {
+ for(i = drawables_list; i; i = i->next) {
if(i->drawable == drawable) {
agd = i;
break;
@@ -174,7 +174,7 @@
* The item must be at the head of the list, if it
* has no previous pointer.
*/
- drawables = agd->next;
+ drawables_list = agd->next;
}
if(agd->next)
@@ -287,12 +287,12 @@
lock_drawables_list();
/* Link the new drawable into the global list. */
- agd->next = drawables;
+ agd->next = drawables_list;
- if(drawables)
- drawables->previous = agd;
+ if(drawables_list)
+ drawables_list->previous = agd;
- drawables = agd;
+ drawables_list = agd;
unlock_drawables_list();
@@ -319,7 +319,7 @@
int (*old_handler)(Display *, XErrorEvent *);
- if(NULL == drawables)
+ if(NULL == drawables_list)
return;
old_handler = XSetErrorHandler(error_handler);
@@ -328,7 +328,7 @@
lock_drawables_list();
- for(d = drawables; d;) {
+ for(d = drawables_list; d;) {
dnext = d->next;
d->lock(d);
@@ -372,3 +372,17 @@
unlock_drawables_list();
}
+
+unsigned int apple_glx_get_drawable_count(void) {
+ unsigned int result = 0;
+ struct apple_glx_drawable *d;
+
+ lock_drawables_list();
+
+ for(d = drawables_list; d; d = d->next)
+ ++result;
+
+ unlock_drawables_list();
+
+ return result;
+}
Modified: AppleSGLX/trunk/apple_glx_drawable.h
===================================================================
--- AppleSGLX/trunk/apple_glx_drawable.h 2009-02-19 05:08:28 UTC (rev 172)
+++ AppleSGLX/trunk/apple_glx_drawable.h 2009-02-19 05:22:57 UTC (rev 173)
@@ -98,4 +98,10 @@
void apple_glx_destroy_drawable_in_any(Display *dpy, GLXDrawable d);
+/*
+ * This returns the total number of drawables.
+ * It's mostly intended for debugging and introspection.
+ */
+unsigned int apple_glx_get_drawable_count(void);
+
#endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090218/f411d341/attachment-0001.html>
More information about the Xquartz-changes
mailing list