Author: cazfi
Date: Mon Sep  7 21:15:26 2015
New Revision: 29806

URL: http://svn.gna.org/viewcvs/freeciv?rev=29806&view=rev
Log:
Fixed editor icon pixbuf leak.

See bug #23853

Modified:
    branches/S2_5/client/gui-gtk-2.0/editgui.c
    branches/S2_5/client/gui-gtk-3.0/editgui.c

Modified: branches/S2_5/client/gui-gtk-2.0/editgui.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-2.0/editgui.c?rev=29806&r1=29805&r2=29806&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-2.0/editgui.c  (original)
+++ branches/S2_5/client/gui-gtk-2.0/editgui.c  Mon Sep  7 21:15:26 2015
@@ -845,11 +845,10 @@
       continue;
     }
     pixbuf = sprite_get_pixbuf(sprite);
-    if (pixbuf == NULL) {
-      continue;
-    }
-
-    gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+    if (pixbuf != NULL) {
+      gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+      g_object_unref(G_OBJECT(pixbuf));
+    }
   } resource_type_iterate_end;
 
 
@@ -870,11 +869,10 @@
       continue;
     }
     pixbuf = sprite_get_pixbuf(sprite);
-    if (pixbuf == NULL) {
-      continue;
-    }
-
-    gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+    if (pixbuf != NULL) {
+      gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+      g_object_unref(G_OBJECT(pixbuf));
+    }
   } tile_special_type_iterate_end;
 
   tvs = eb->tool_selectors[ETT_ROAD];
@@ -940,11 +938,10 @@
       continue;
     }
     pixbuf = sprite_get_pixbuf(sprite);
-    if (pixbuf == NULL) {
-      continue;
-    }
-
-    gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+    if (pixbuf != NULL) {
+      gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+      g_object_unref(G_OBJECT(pixbuf));
+    }
   } unit_type_iterate_end;
 }
 

Modified: branches/S2_5/client/gui-gtk-3.0/editgui.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-gtk-3.0/editgui.c?rev=29806&r1=29805&r2=29806&view=diff
==============================================================================
--- branches/S2_5/client/gui-gtk-3.0/editgui.c  (original)
+++ branches/S2_5/client/gui-gtk-3.0/editgui.c  Mon Sep  7 21:15:26 2015
@@ -881,11 +881,10 @@
       continue;
     }
     pixbuf = sprite_get_pixbuf(sprite);
-    if (pixbuf == NULL) {
-      continue;
-    }
-
-    gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+    if (pixbuf != NULL) {
+      gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+      g_object_unref(G_OBJECT(pixbuf));
+    }
   } tile_special_type_iterate_end;
 
   /* Reload roads. */
@@ -953,12 +952,10 @@
       continue;
     }
     pixbuf = sprite_get_pixbuf(sprite);
-    if (pixbuf == NULL) {
-      continue;
-    }
-
-    gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
-    g_object_unref(G_OBJECT(pixbuf));
+    if (pixbuf != NULL) {
+      gtk_list_store_set(store, &iter, TVS_COL_IMAGE, pixbuf, -1);
+      g_object_unref(G_OBJECT(pixbuf));
+    }
   } unit_type_iterate_end;
 }
 


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

Reply via email to