Author: cazfi
Date: Sat Nov  5 08:16:48 2016
New Revision: 34397

URL: http://svn.gna.org/viewcvs/freeciv?rev=34397&view=rev
Log:
Sdl-clients ignore requests from client-common code to switch theme once there 
is one already loaded.

This avoids some crashes reported by Jacob Nevins <jtn>

See bug #25117

Modified:
    branches/S2_6/client/gui-sdl/themes.c
    branches/S2_6/client/gui-sdl2/themes.c

Modified: branches/S2_6/client/gui-sdl/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/themes.c?rev=34397&r1=34396&r2=34397&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl/themes.c       (original)
+++ branches/S2_6/client/gui-sdl/themes.c       Sat Nov  5 08:16:48 2016
@@ -37,6 +37,11 @@
   char buf[strlen(directory) + strlen(DIR_SEPARATOR) + strlen(theme_name)
            + strlen(DIR_SEPARATOR "theme") + 1];
 
+  if (theme != NULL) {
+    /* We don't support changing theme once it has been loaded */
+    return;
+  }
+
   /* free previous loaded theme, if any */
   theme_free(theme);
   theme = NULL;
@@ -53,9 +58,6 @@
 *****************************************************************************/
 void gui_clear_theme(void)
 {
-  theme_free(theme);
-  theme = NULL;
-
   if (!load_theme(gui_options.gui_sdl_default_theme_name)) {
     /* TRANS: No full stop after the URL, could cause confusion. */
     log_fatal(_("No Sdl-client theme was found. For instructions on how to "

Modified: branches/S2_6/client/gui-sdl2/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/themes.c?rev=34397&r1=34396&r2=34397&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/themes.c      (original)
+++ branches/S2_6/client/gui-sdl2/themes.c      Sat Nov  5 08:16:48 2016
@@ -37,6 +37,11 @@
   char buf[strlen(directory) + strlen(DIR_SEPARATOR) + strlen(theme_name)
            + strlen(DIR_SEPARATOR "theme") + 1];
 
+  if (theme != NULL) {
+    /* We don't support changing theme once it has been loaded */
+    return;
+  }
+
   /* free previous loaded theme, if any */
   theme_free(theme);
   theme = NULL;
@@ -53,9 +58,6 @@
 *****************************************************************************/
 void gui_clear_theme(void)
 {
-  theme_free(theme);
-  theme = NULL;
-
   if (!load_theme(gui_options.gui_sdl2_default_theme_name)) {
     /* TRANS: No full stop after the URL, could cause confusion. */
     log_fatal(_("No Sdl2-client theme was found. For instructions on how to "


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

Reply via email to