Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2365) gui-gtk: free_sprite doesn't free mask
Home

[Freeciv-Dev] (PR#2365) gui-gtk: free_sprite doesn't free mask

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2365) gui-gtk: free_sprite doesn't free mask
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 19 Nov 2002 14:57:20 -0800
Reply-to: rt@xxxxxxxxxxxxxx

The free_sprite() function in the GTK client doesn't free the sprite's 
mask.  This means a certain amount of memory leak will be unavoidable, 
especially when switching tilesets.

The attached patch seems like it would work.  But it doesn't - sometimes 
I get the warning:

Gdk-CRITICAL **: file gdkpixmap.c: line 823 (gdk_pixmap_unref): 
assertion `private->ref_count > 0' failed.

indicating that perhaps the mask has already been freed.  I have not 
been able to figure out why this happens.

jason

? client/gui-gtk/diff
Index: client/gui-gtk/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.c,v
retrieving revision 1.47
diff -u -r1.47 graphics.c
--- client/gui-gtk/graphics.c   2002/11/14 09:14:53     1.47
+++ client/gui-gtk/graphics.c   2002/11/19 22:54:06
@@ -342,6 +342,9 @@
 void free_sprite(SPRITE *s)
 {
   gdk_imlib_free_pixmap(s->pixmap);
+  if (s->has_mask && s->mask) {
+    gdk_imlib_free_pixmap(s->mask);
+  }
   free(s);
   return;
 }

[Prev in Thread] Current Thread [Next in Thread]