Author: cazfi
Date: Sun Apr 10 12:01:54 2016
New Revision: 32338

URL: http://svn.gna.org/viewcvs/freeciv?rev=32338&view=rev
Log:
Free indicator icon pixbufs in gtk3-client.

See bug #24565

Modified:
    trunk/client/gui-gtk-3.0/gui_main.c
    trunk/client/gui-gtk-3.0/mapview.c

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=32338&r1=32337&r2=32338&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Sun Apr 10 12:01:54 2016
@@ -1067,6 +1067,7 @@
   char buf[256];
   GtkWidget *notebook, *statusbar;
   GtkWidget *dtach_lowbox = NULL;
+  GdkPixbuf *pb;
 
   message_buffer = gtk_text_buffer_new(NULL);
 
@@ -1253,19 +1254,25 @@
                      G_CALLBACK(taxrates_callback), GINT_TO_POINTER(i));
 
     spr = i < 5 ? get_tax_sprite(tileset, O_SCIENCE) : get_tax_sprite(tileset, 
O_GOLD);
-    econ_label[i] = gtk_image_new_from_pixbuf(sprite_get_pixbuf(spr));
+    pb = sprite_get_pixbuf(spr);
+    econ_label[i] = gtk_image_new_from_pixbuf(pb);
+    g_object_unref(pb);
     gtk_container_add(GTK_CONTAINER(ebox), econ_label[i]);
   }
 
   /* science, environmental, govt, timeout */
-  bulb_label
-    = gtk_image_new_from_pixbuf(sprite_get_pixbuf(client_research_sprite()));
-  sun_label
-    = gtk_image_new_from_pixbuf(sprite_get_pixbuf(client_warming_sprite()));
-  flake_label
-    = gtk_image_new_from_pixbuf(sprite_get_pixbuf(client_cooling_sprite()));
-  government_label
-    = gtk_image_new_from_pixbuf(sprite_get_pixbuf(client_government_sprite()));
+  pb = sprite_get_pixbuf(client_research_sprite());
+  bulb_label = gtk_image_new_from_pixbuf(pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(client_warming_sprite());
+  sun_label = gtk_image_new_from_pixbuf(pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(client_cooling_sprite());
+  flake_label = gtk_image_new_from_pixbuf(pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(client_government_sprite());
+  government_label = gtk_image_new_from_pixbuf(pb);
+  g_object_unref(pb);
 
   for (i = 0; i < 4; i++) {
     GtkWidget *w;

Modified: trunk/client/gui-gtk-3.0/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapview.c?rev=32338&r1=32337&r2=32338&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/mapview.c  (original)
+++ trunk/client/gui-gtk-3.0/mapview.c  Sun Apr 10 12:01:54 2016
@@ -164,21 +164,30 @@
 
     for (; d < client.conn.playing->economic.luxury /10; d++) {
       struct sprite *spr = get_tax_sprite(tileset, O_LUXURY);
-
-      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), 
sprite_get_pixbuf(spr));
+      GdkPixbuf *pb;
+
+      pb = sprite_get_pixbuf(spr);
+      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), pb);
+      g_object_unref(pb);
     }
 
     for (; d < (client.conn.playing->economic.science
                + client.conn.playing->economic.luxury) / 10; d++) {
       struct sprite *spr = get_tax_sprite(tileset, O_SCIENCE);
-
-      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), 
sprite_get_pixbuf(spr));
+      GdkPixbuf *pb;
+
+      pb = sprite_get_pixbuf(spr);
+      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), pb);
+      g_object_unref(pb);
     }
 
     for (; d < 10; d++) {
       struct sprite *spr = get_tax_sprite(tileset, O_GOLD);
-
-      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), 
sprite_get_pixbuf(spr));
+      GdkPixbuf *pb;
+
+      pb = sprite_get_pixbuf(spr);
+      gtk_image_set_from_pixbuf(GTK_IMAGE(econ_label[d]), pb);
+      g_object_unref(pb);
     }
   }
 
@@ -272,10 +281,20 @@
 void set_indicator_icons(struct sprite *bulb, struct sprite *sol,
                          struct sprite *flake, struct sprite *gov)
 {
-  gtk_image_set_from_pixbuf(GTK_IMAGE(bulb_label), sprite_get_pixbuf(bulb));
-  gtk_image_set_from_pixbuf(GTK_IMAGE(sun_label), sprite_get_pixbuf(sol));
-  gtk_image_set_from_pixbuf(GTK_IMAGE(flake_label), sprite_get_pixbuf(flake));
-  gtk_image_set_from_pixbuf(GTK_IMAGE(government_label), 
sprite_get_pixbuf(gov));
+  GdkPixbuf *pb;
+
+  pb = sprite_get_pixbuf(bulb);
+  gtk_image_set_from_pixbuf(GTK_IMAGE(bulb_label), pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(sol);
+  gtk_image_set_from_pixbuf(GTK_IMAGE(sun_label), pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(flake);
+  gtk_image_set_from_pixbuf(GTK_IMAGE(flake_label), pb);
+  g_object_unref(pb);
+  pb = sprite_get_pixbuf(gov);
+  gtk_image_set_from_pixbuf(GTK_IMAGE(government_label), pb);
+  g_object_unref(pb);
 }
 
 /****************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to