<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39987 >
Thank you for bringing this to our attention. Your single line patch uncovered a plethora of other problems! Showing the toplevel window after the theme is applied was a good idea. But AFAICT, set_client_state() clears menus, and sets up pages, and generally assumes the toplevel widget is ready. Turns out that somebody changed TIMER_INTERVAL from a constant to a call to real_timer_callback(), which in turn assumes that client_state is set. Finally, the old gtk_timeout_add() was deprecated. Replaced it and its callback function (and the inaccurate function header comments). Committed trunk revision 14217. Committed S2_2 revision 14218. Committed S2_1 revision 14219.
Index: client/gui-gtk-2.0/gui_main.c =================================================================== --- client/gui-gtk-2.0/gui_main.c (revision 14216) +++ client/gui-gtk-2.0/gui_main.c (working copy) @@ -295,7 +295,6 @@ static gboolean select_unit_pixmap_callback(GtkWidget *w, GdkEvent *ev, gpointer data); -static gint timer_callback(gpointer data); static gboolean quit_dialog_callback(void); @@ -329,6 +328,19 @@ } /************************************************************************** + Called while in gtk_main() (which is all of the time) + TIMER_INTERVAL is now set by real_timer_callback() +**************************************************************************/ +static gboolean timer_callback(gpointer data) +{ + double seconds = real_timer_callback(); + + timer_id = g_timeout_add(seconds * 1000, timer_callback, NULL); + + return FALSE; +} + +/************************************************************************** Print extra usage information, including one line help on each option, to stderr. **************************************************************************/ @@ -1513,15 +1525,17 @@ history_list = genlist_new(); history_pos = -1; - gtk_widget_show(toplevel); + init_mapcanvas_and_overview(); - timer_id = gtk_timeout_add(TIMER_INTERVAL, timer_callback, NULL); + tileset_use_prefered_theme(tileset); - init_mapcanvas_and_overview(); + gtk_widget_show(toplevel); + /* assumes toplevel showing */ set_client_state(C_S_PREPARING); - tileset_use_prefered_theme(tileset); + /* assumes client_state is set */ + timer_id = g_timeout_add(TIMER_INTERVAL, timer_callback, NULL); gtk_main(); @@ -1786,19 +1800,6 @@ } /************************************************************************** - this is called every TIMER_INTERVAL milliseconds whilst we are in - gtk_main() (which is all of the time) TIMER_INTERVAL needs to be .5s -**************************************************************************/ -static gint timer_callback(gpointer data) -{ - double seconds = real_timer_callback(); - - timer_id = gtk_timeout_add(seconds * 1000, timer_callback, NULL); - - return FALSE; -} - -/************************************************************************** ... **************************************************************************/ static gboolean show_info_button_release(GtkWidget *w, GdkEventButton *ev, gpointer data)
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev