From sh@root-login.org  Fri Apr 12 07:16:43 2002
Return-Path: <sh@root-login.org>
Received: from moutvdom01.kundenserver.de (moutvdom01.kundenserver.de [195.20.224.200])
	by hub.freebsd.org (Postfix) with ESMTP id CF88637B405
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 12 Apr 2002 07:16:41 -0700 (PDT)
Received: from [172.19.20.61] (helo=mrvdomng0.kundenserver.de)
	by moutvdom01.kundenserver.de with esmtp (Exim 2.12 #2)
	id 16w1qu-0006MQ-00
	for FreeBSD-gnats-submit@freebsd.org; Fri, 12 Apr 2002 16:16:36 +0200
Received: from [217.83.12.168] (helo=mother.chief.home)
	by mrvdomng0.kundenserver.de with esmtp (Exim 3.22 #2)
	id 16w1qs-0004S7-00
	for FreeBSD-gnats-submit@freebsd.org; Fri, 12 Apr 2002 16:16:34 +0200
Received: (from root@localhost)
	by mother.chief.home (8.11.6/8.11.6) id g3CEGWZ01134;
	Fri, 12 Apr 2002 16:16:32 +0200 (CEST)
	(envelope-from aperum)
Message-Id: <200204121416.g3CEGWZ01134@mother.chief.home>
Date: Fri, 12 Apr 2002 16:16:32 +0200 (CEST)
From: Sascha Holzleiter <sascha@root-login.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] for x11-toolkits/gtk-engines memory leak
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         37022
>Category:       ports
>Synopsis:       [PATCH] for x11-toolkits/gtk-engines memory leak
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnome
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 12 07:20:01 PDT 2002
>Closed-Date:    Fri Apr 12 10:14:58 PDT 2002
>Last-Modified:  Fri Apr 12 10:14:58 PDT 2002
>Originator:     Sascha Holzleiter
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
>Description:
	pixmap resource leak when pixmaps
	are rendered but not used, because there was no
	area that needed to be drawn.

	Already reportet in PR ports/36044
	
>How-To-Repeat:

        using any pixmap gtk+ theme leets the X process grow infinitly.
>Fix:

I've included the diff from the new cvs version of the file to the one in the ports collection.
This should fix the bug as far as i've tested it.


--- leakfix begins here ---
--- pixmap_theme_draw.c	Mon Feb  7 03:33:43 2000
+++ /e/patches/pixmap_theme_draw.c	Fri Apr 12 15:24:40 2002
@@ -403,8 +403,9 @@
 		      gdk_gc_set_clip_origin(gc, 0, 0);
 		    }
 		}
-	      gdk_imlib_free_pixmap(p);
 	    }
+	  if (p)
+	    gdk_imlib_free_pixmap(p);
 	  gdk_imlib_destroy_image(im);
 	}
     }
@@ -467,8 +468,9 @@
 	  gdk_gc_set_clip_mask(gc, NULL);
 	  gdk_gc_set_clip_origin(gc, 0, 0);
 	}
-      gdk_imlib_free_pixmap(p);
     }
+  if (p)
+    gdk_imlib_free_pixmap(p);
   gdk_imlib_destroy_image(im);
 }
 
@@ -591,8 +593,9 @@
 		  gdk_gc_set_clip_mask(gc, NULL);
 		  gdk_gc_set_clip_origin(gc, 0, 0);
 		}
-	      gdk_imlib_free_pixmap(p);
 	    }
+	  if (p)
+	    gdk_imlib_free_pixmap(p);
 	  gdk_imlib_destroy_image(im);
 	}
     }
@@ -956,11 +959,13 @@
 		  gdk_gc_set_clip_mask(gc, NULL);
 		  gdk_gc_set_clip_origin(gc, 0, 0);
 		}
-
-	      gdk_imlib_free_pixmap(p);
-	      gdk_imlib_free_pixmap(p1);
-	      gdk_imlib_free_pixmap(p2);
 	    }
+	  if (p)
+	    gdk_imlib_free_pixmap(p);
+	  if (p1)
+	    gdk_imlib_free_pixmap(p1);
+	  if (p2)
+	    gdk_imlib_free_pixmap(p2);
 	  gdk_imlib_destroy_image(im);
 	  gdk_imlib_destroy_image(im1);
 	  gdk_imlib_destroy_image(im2);
@@ -1202,11 +1207,15 @@
 		  gdk_gc_set_clip_mask(gc, NULL);
 		  gdk_gc_set_clip_origin(gc, 0, 0);
 		}
-	      gdk_imlib_free_pixmap(p);
-	      gdk_imlib_free_pixmap(p1);
-	      gdk_imlib_free_pixmap(p2);
-	      gdk_imlib_free_pixmap(p3);
 	    }
+	  if (p)
+	    gdk_imlib_free_pixmap(p);
+	  if (p1)
+	    gdk_imlib_free_pixmap(p1);
+	  if (p2)
+	    gdk_imlib_free_pixmap(p2);
+	  if (p3)
+	    gdk_imlib_free_pixmap(p3);
 	  gdk_imlib_destroy_image(im);
 	  gdk_imlib_destroy_image(im1);
 	  gdk_imlib_destroy_image(im2);
--- leakfix ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->gnome 
Responsible-Changed-By: marcus 
Responsible-Changed-When: Fri Apr 12 08:45:55 PDT 2002 
Responsible-Changed-Why:  
Over to maintainers. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37022 
State-Changed-From-To: open->closed 
State-Changed-By: marcus 
State-Changed-When: Fri Apr 12 10:14:39 PDT 2002 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37022 
>Unformatted:
