Author: cazfi
Date: Mon Sep  7 21:15:13 2015
New Revision: 29805

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

See bug #23853

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

Modified: branches/S2_6/client/gui-gtk-2.0/editgui.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/editgui.c?rev=29805&r1=29804&r2=29805&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-2.0/editgui.c  (original)
+++ branches/S2_6/client/gui-gtk-2.0/editgui.c  Mon Sep  7 21:15:13 2015
@@ -809,11 +809,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;
 
 
@@ -899,11 +898,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_6/client/gui-gtk-3.0/editgui.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/editgui.c?rev=29805&r1=29804&r2=29805&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/editgui.c  (original)
+++ branches/S2_6/client/gui-gtk-3.0/editgui.c  Mon Sep  7 21:15:13 2015
@@ -817,14 +817,11 @@
       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));
+    }
   } resource_type_iterate_end;
-
 
   /* Reload terrain specials. */
 
@@ -910,12 +907,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