Author: cazfi
Date: Fri Aug 12 18:42:05 2016
New Revision: 33575

URL: http://svn.gna.org/viewcvs/freeciv?rev=33575&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:
    trunk/client/gui-sdl2/mapctrl.c
    trunk/client/update_queue.c
    trunk/client/update_queue.h

Modified: trunk/client/gui-sdl2/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapctrl.c?rev=33575&r1=33574&r2=33575&view=diff
==============================================================================
--- trunk/client/gui-sdl2/mapctrl.c     (original)
+++ trunk/client/gui-sdl2/mapctrl.c     Fri Aug 12 18:42:05 2016
@@ -42,6 +42,7 @@
 #include "client_main.h"
 #include "climisc.h"
 #include "overview_common.h"
+#include "update_queue.h"
 
 /* client/gui-sdl2 */
 #include "citydlg.h"
@@ -2914,7 +2915,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: trunk/client/update_queue.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/update_queue.c?rev=33575&r1=33574&r2=33575&view=diff
==============================================================================
--- trunk/client/update_queue.c (original)
+++ trunk/client/update_queue.c Fri Aug 12 18:42:05 2016
@@ -529,6 +529,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: trunk/client/update_queue.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/update_queue.h?rev=33575&r1=33574&r2=33575&view=diff
==============================================================================
--- trunk/client/update_queue.h (original)
+++ trunk/client/update_queue.h Fri Aug 12 18:42:05 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