Author: cazfi
Date: Fri Aug 12 18:42:19 2016
New Revision: 33577

URL: http://svn.gna.org/viewcvs/freeciv?rev=33577&view=rev
Log:
Made sdl-clients not to access PAGE_GAME widgets that have already been freed 
when actual page change is
still unprocessed in the queue.

See bug #23992

Modified:
    branches/S2_5/client/gui-sdl/mapctrl.c
    branches/S2_5/client/update_queue.c
    branches/S2_5/client/update_queue.h

Modified: branches/S2_5/client/gui-sdl/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-sdl/mapctrl.c?rev=33577&r1=33576&r2=33577&view=diff
==============================================================================
--- branches/S2_5/client/gui-sdl/mapctrl.c      (original)
+++ branches/S2_5/client/gui-sdl/mapctrl.c      Fri Aug 12 18:42:19 2016
@@ -1,4 +1,4 @@
-/**********************************************************************
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    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
@@ -11,13 +11,13 @@
    GNU General Public License for more details.
 ***********************************************************************/
 
-/**********************************************************************
+/***********************************************************************
                           mapctrl.c  -  description
                              -------------------
     begin                : Thu Sep 05 2002
     copyright            : (C) 2002 by Rafał Bursig
     email                : Rafał Bursig <bur...@poczta.fm>
- **********************************************************************/
+***********************************************************************/
 #ifdef HAVE_CONFIG_H
 #include <fc_config.h>
 #endif
@@ -36,6 +36,7 @@
 #include "client_main.h"
 #include "climisc.h"
 #include "overview_common.h"
+#include "update_queue.h"
 
 /* client/gui-sdl */
 #include "citydlg.h"
@@ -2720,7 +2721,8 @@
 **************************************************************************/
 void set_turn_done_button_state(bool state)
 {
-  if (PAGE_GAME == get_current_client_page()) {
+  if (PAGE_GAME == get_current_client_page()
+      && !update_queue_is_switching_page()) {
     if (state) {
       set_wstate(pNew_Turn_Button, FC_WS_NORMAL);
     } else {

Modified: branches/S2_5/client/update_queue.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/update_queue.c?rev=33577&r1=33576&r2=33577&view=diff
==============================================================================
--- branches/S2_5/client/update_queue.c (original)
+++ branches/S2_5/client/update_queue.c Fri Aug 12 18:42:19 2016
@@ -515,6 +515,13 @@
   }
 }
 
+/****************************************************************************
+  Returns whether there's page switching already in progress.
+****************************************************************************/
+bool update_queue_is_switching_page(void)
+{
+  return update_queue_has_callback(set_client_page_callback);
+}
 
 /****************************************************************************
   Update the menus.

Modified: branches/S2_5/client/update_queue.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/update_queue.h?rev=33577&r1=33576&r2=33577&view=diff
==============================================================================
--- branches/S2_5/client/update_queue.h (original)
+++ branches/S2_5/client/update_queue.h Fri Aug 12 18:42:19 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    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
@@ -60,6 +60,8 @@
                                                    uq_free_fn_t
                                                    free_data_func);
 
+bool update_queue_is_switching_page(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */


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

Reply via email to