Author: cazfi
Date: Fri Feb 20 23:49:15 2015
New Revision: 28242

URL: http://svn.gna.org/viewcvs/freeciv?rev=28242&view=rev
Log:
Do not try to redraw science dialog while tileset change is ongoing and there's 
no guarantee
that all the sprites are available.

See bug #22625

Modified:
    trunk/client/gui-gtk-2.0/repodlgs.c
    trunk/client/gui-gtk-3.0/repodlgs.c
    trunk/client/reqtree.c
    trunk/client/tilespec.c
    trunk/client/tilespec.h

Modified: trunk/client/gui-gtk-2.0/repodlgs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/repodlgs.c?rev=28242&r1=28241&r2=28242&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/repodlgs.c (original)
+++ trunk/client/gui-gtk-2.0/repodlgs.c Fri Feb 20 23:49:15 2015
@@ -238,6 +238,10 @@
   };
   struct reqtree *reqtree = g_object_get_data(G_OBJECT(widget), "reqtree");
   int width, height;
+
+  if (!tileset_is_fully_loaded()) {
+    return;
+  }
 
   get_reqtree_dimensions(reqtree, &width, &height);
   draw_reqtree(reqtree, &canvas, 0, 0, 0, 0, width, height);

Modified: trunk/client/gui-gtk-3.0/repodlgs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/repodlgs.c?rev=28242&r1=28241&r2=28242&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/repodlgs.c (original)
+++ trunk/client/gui-gtk-3.0/repodlgs.c Fri Feb 20 23:49:15 2015
@@ -241,6 +241,10 @@
   GtkAdjustment *vadjustment;
   gint hadjustment_value;
   gint vadjustment_value;
+
+  if (!tileset_is_fully_loaded()) {
+    return TRUE;
+  }
 
   hadjustment = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(widget));
   vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(widget));

Modified: trunk/client/reqtree.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/reqtree.c?rev=28242&r1=28241&r2=28242&view=diff
==============================================================================
--- trunk/client/reqtree.c      (original)
+++ trunk/client/reqtree.c      Fri Feb 20 23:49:15 2015
@@ -1070,7 +1070,7 @@
         * node_rectangle_minimum_size(). If you change something here,
         * change also node_rectangle_minimum_size().
         */
-                            
+
        get_text_size(&text_w, &text_h, FONT_REQTREE_TEXT, text);
 
        canvas_put_text(pcanvas,

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=28242&r1=28241&r2=28242&view=diff
==============================================================================
--- trunk/client/tilespec.c     (original)
+++ trunk/client/tilespec.c     Fri Feb 20 23:49:15 2015
@@ -519,6 +519,8 @@
 
 int focus_unit_state = 0;
 
+static bool tileset_update = FALSE;
+
 
 static int fill_unit_type_sprite_array(const struct tileset *t,
                                        struct drawn_sprite *sprs,
@@ -1219,7 +1221,9 @@
   const char *tileset_name = option_str_get(poption);
 
   fc_assert_ret(NULL != tileset_name && tileset_name[0] != '\0');
+  tileset_update = TRUE;
   tilespec_reread(tileset_name, client.conn.established);
+  tileset_update = FALSE;
   menus_init();
 }
 
@@ -6312,3 +6316,11 @@
     }
   }
 }
+
+/****************************************************************************
+  Is tileset in sane state?
+****************************************************************************/
+bool tileset_is_fully_loaded(void)
+{
+  return !tileset_update;
+}

Modified: trunk/client/tilespec.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.h?rev=28242&r1=28241&r2=28242&view=diff
==============================================================================
--- trunk/client/tilespec.h     (original)
+++ trunk/client/tilespec.h     Fri Feb 20 23:49:15 2015
@@ -180,6 +180,7 @@
 void tileset_load_tiles(struct tileset *t);
 void tileset_free_tiles(struct tileset *t);
 void tileset_ruleset_reset(struct tileset *t);
+bool tileset_is_fully_loaded(void);
 
 void finish_loading_sprites(struct tileset *t);
 


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

Reply via email to