[Xquartz-changes] [174] AppleSGLX/trunk/apple_glx_pixmap.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 18 21:41:17 PST 2009


Revision: 174
          http://trac.macosforge.org/projects/xquartz/changeset/174
Author:   gstaplin at apple.com
Date:     2009-02-18 21:41:17 -0800 (Wed, 18 Feb 2009)
Log Message:
-----------
Improve apple_glx_pixmap_destroy error handling in an effort
to determine where something seems to be leaking memory.

/usr/bin/leaks doesn't find the missing allocation, and it's
not related to the drawable structures leaking from what I
gather with the new introspection of the drawables count.

It's not a big leak, but it's a noticeable leak after some time.

Modified Paths:
--------------
    AppleSGLX/trunk/apple_glx_pixmap.c

Modified: AppleSGLX/trunk/apple_glx_pixmap.c
===================================================================
--- AppleSGLX/trunk/apple_glx_pixmap.c	2009-02-19 05:22:57 UTC (rev 173)
+++ AppleSGLX/trunk/apple_glx_pixmap.c	2009-02-19 05:41:17 UTC (rev 174)
@@ -170,7 +170,7 @@
 
 void apple_glx_pixmap_destroy(Display *dpy, GLXPixmap pixmap) {
     struct apple_glx_pixmap *p;
-
+    
     lock_pixmap_list();
 
     if(find_pixmap(pixmap, &p)) {
@@ -181,10 +181,18 @@
 	(void)apple_cgl.destroy_pixel_format(p->pixel_format_obj);
 	(void)apple_cgl.destroy_context(p->context_obj);
 	XAppleDRIDestroyPixmap(dpy, pixmap);
-	munmap(p->buffer, p->size);
-	close(p->fd);
-        shm_unlink(p->path);
 
+	if(munmap(p->buffer, p->size))
+	    perror("munmap");
+
+	if(-1 == close(p->fd))
+	    perror("close");
+
+        if(shm_unlink(p->path))
+	    perror("shm_unlink");
+
+	/* Delink the pixmap from the pixmap_list. */
+	
 	if(p->previous) {
 	    p->previous->next = p->next;
 	} else {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090218/4ff95817/attachment-0001.html>


More information about the Xquartz-changes mailing list