Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] (PR#3746) explosion sprites are loaded twice
Home

[Freeciv-Dev] (PR#3746) explosion sprites are loaded twice

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#3746) explosion sprites are loaded twice
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Mar 2003 22:32:36 -0800
Reply-to: rt@xxxxxxxxxxxxxx

One thing I just noticed about the new sprite loading code is that the
unit explosion sprites are loaded twice - once when counting how many
explosion sprites there are, and a second time when putting them into an
array.  This just means there is an extra reference to the sprite, which
means if unload_sprite were ever called (outside of free_all_sprites) on
these sprites we probably wouldn't end up releasing the pixmap immediately.

The attached patch is a poor solution to this problem.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.112
diff -u -r1.112 tilespec.c
--- client/tilespec.c   2003/03/18 06:24:18     1.112
+++ client/tilespec.c   2003/03/18 06:29:27
@@ -868,6 +868,10 @@
     for (i = 0; i < num_tiles_explode_unit; i++) {
       my_snprintf(buffer, sizeof(buffer), "explode.unit_%d", i);
       SET_SPRITE(explode.unit[i], buffer);
+
+      /* HACK: since the sprite has already been loaded up above, we don't
+       * want to introduce a new reference.  So we reduce it here. */
+      unload_sprite(buffer);
     }
   }
 

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