Author: cazfi
Date: Wed May  4 18:41:08 2016
New Revision: 32578

URL: http://svn.gna.org/viewcvs/freeciv?rev=32578&view=rev
Log:
Free gtk3-client editbar icons on exit

See bug #24634

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

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=32578&r1=32577&r2=32578&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/editgui.c  (original)
+++ branches/S2_6/client/gui-gtk-3.0/editgui.c  Wed May  4 18:41:08 2016
@@ -787,6 +787,19 @@
 }
 
 /****************************************************************************
+  Clears all stores from the editbar.
+****************************************************************************/
+static void clear_tool_stores(struct editbar *eb)
+{
+  clear_tool_store(eb->tool_selectors[ETT_TERRAIN]->store);
+  clear_tool_store(eb->tool_selectors[ETT_TERRAIN_RESOURCE]->store);
+  clear_tool_store(eb->tool_selectors[ETT_TERRAIN_SPECIAL]->store);
+  clear_tool_store(eb->tool_selectors[ETT_ROAD]->store);
+  clear_tool_store(eb->tool_selectors[ETT_MILITARY_BASE]->store);
+  clear_tool_store(eb->tool_selectors[ETT_UNIT]->store);
+}
+
+/****************************************************************************
   Reload all tool value data from the tileset for the given toolbar.
 ****************************************************************************/
 static void editbar_reload_tileset(struct editbar *eb)
@@ -801,11 +814,12 @@
     return;
   }
 
+  clear_tool_stores(eb);
+
   /* Reload terrains. */
 
   tvs = eb->tool_selectors[ETT_TERRAIN];
   store = tvs->store;
-  clear_tool_store(store);
 
   terrain_type_iterate(pterrain) {
     gtk_list_store_append(store, &iter);
@@ -825,7 +839,6 @@
 
   tvs = eb->tool_selectors[ETT_TERRAIN_RESOURCE];
   store = tvs->store;
-  clear_tool_store(store);
 
   resource_type_iterate(presource) {
     gtk_list_store_append(store, &iter);
@@ -848,7 +861,6 @@
 
   tvs = eb->tool_selectors[ETT_TERRAIN_SPECIAL];
   store = tvs->store;
-  clear_tool_store(store);
 
   extra_type_by_cause_iterate(EC_SPECIAL, pextra) {
     gtk_list_store_append(store, &iter);
@@ -867,7 +879,6 @@
 
   tvs = eb->tool_selectors[ETT_ROAD];
   store = tvs->store;
-  clear_tool_store(store);
 
   extra_type_by_cause_iterate(EC_ROAD, pextra) {
     gtk_list_store_append(store, &iter);
@@ -886,7 +897,6 @@
 
   tvs = eb->tool_selectors[ETT_MILITARY_BASE];
   store = tvs->store;
-  clear_tool_store(store);
 
   extra_type_by_cause_iterate(EC_BASE, pextra) {
     gtk_list_store_append(store, &iter);
@@ -906,7 +916,6 @@
 
   tvs = eb->tool_selectors[ETT_UNIT];
   store = tvs->store;
-  clear_tool_store(store);
 
   unit_type_iterate(putype) {
     gtk_list_store_append(store, &iter);
@@ -1870,6 +1879,16 @@
 }
 
 /****************************************************************************
+  Free everything allocated for the editgui.
+****************************************************************************/
+void editgui_free(void)
+{
+  struct editbar *eb = editgui_get_editbar();
+
+  clear_tool_stores(eb);
+}
+
+/****************************************************************************
   Return a pointer to the editor info box embedded in the client's GUI.
 ****************************************************************************/
 struct editinfobox *editgui_get_editinfobox(void)

Modified: branches/S2_6/client/gui-gtk-3.0/editgui.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/editgui.h?rev=32578&r1=32577&r2=32578&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/editgui.h  (original)
+++ branches/S2_6/client/gui-gtk-3.0/editgui.h  Wed May  4 18:41:08 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 2005 - The Freeciv Project
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -62,6 +62,7 @@
 };
 
 void editgui_create_widgets(void);
+void editgui_free(void);
 struct editbar *editgui_get_editbar(void);
 struct editinfobox *editgui_get_editinfobox(void);
 

Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/gui_main.c?rev=32578&r1=32577&r2=32578&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_6/client/gui-gtk-3.0/gui_main.c Wed May  4 18:41:08 2016
@@ -1793,6 +1793,7 @@
   diplomacy_dialog_done();
   cma_fe_done();
   free_unit_table();
+  editgui_free();
   gtk_widget_destroy(toplevel_tabs);
   message_buffer = NULL; /* Result of destruction of everything */
   tileset_free_tiles(tileset);


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

Reply via email to