[Freeciv-Dev] (PR#35373) [SDL] city options panel crashbug

2007-02-08 Thread Christian Prochaska

http://bugs.freeciv.org/Ticket/Display.html?id=35373 >

> [dmarks - Mi 07. Feb 2007, 13:30:45]:
> 
> SDL client on recent 2.1.99-devel:
> 
> The city options panel is garbled and on access randomly crashes the
> client with:
> 
> 1: Unable to create Sprite (Surface) of size 794636 x 819204 16 Bits in
> format 0
> 
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> SDL_DisplayFormatAlpha (surface=0x0) at src/video/SDL_video.c:984
> 984 src/video/SDL_video.c: No such file or directory.
> in src/video/SDL_video.c
> 
> 
>  ~Daniel
> 

Patch attached.

Index: client/gui-sdl/citydlg.c
===
--- client/gui-sdl/citydlg.c	(Revision 12603)
+++ client/gui-sdl/citydlg.c	(Arbeitskopie)
@@ -974,18 +974,18 @@
 
   if (BV_ISSET(pCity->city_options, CITYO_NEW_EINSTEIN)) {
 pSurf = get_tax_surface(O_SCIENCE);
-pBuf = create_icon_button(pSurf, pWindow->dst, pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME);
+pBuf = create_icon_button(pSurf, pWindow->dst, pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME2);
 add_to_gui_list(MAX_ID - 0x20, pBuf);
   } else {
 if (BV_ISSET(pCity->city_options, CITYO_NEW_TAXMAN)) {
   pSurf = get_tax_surface(O_GOLD);
   pBuf = create_icon_button(pSurf, pWindow->dst,
-  pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME);
+  pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME2);
   add_to_gui_list(MAX_ID - 0x40, pBuf);
 } else {
   pSurf = get_tax_surface(O_LUXURY);
   pBuf = create_icon_button(pSurf, pWindow->dst,
-pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME);
+pStr, WF_ICON_CENTER_RIGHT | WF_FREE_THEME2);
   add_to_gui_list(MAX_ID - 0x60, pBuf);
 }
   }
Index: client/gui-sdl/widget.h
===
--- client/gui-sdl/widget.h	(Revision 12603)
+++ client/gui-sdl/widget.h	(Arbeitskopie)
@@ -64,28 +64,30 @@
 /* Widget FLAGS -> allowed 20 flags */
 /* default: ICON_CENTER_Y, ICON_ON_LEFT */
 enum widget_flag {
-  WF_HIDDEN= (1<<10),	/* 1024 */
-  /* widget->gfx may be freed */
-  WF_FREE_GFX	 			= (1<<11),	/* 2048 */
-  /* widget->theme may be freed */
-  WF_FREE_THEME= (1<<12),	/* 4096 */
-  /* widget->string may be freed */
-  WF_FREE_STRING			= (1<<13),	/* 8192 */
-  /* widget->data may be freed */
-  WF_FREE_DATA			 	= (1<<14),	/* 16384 */
-  /* widget->private_data may be freed */
-  WF_FREE_PRIVATE_DATA			= (1<<15),	/* 32768 */
-  WF_ICON_ABOVE_TEXT			= (1<<16),	/* 32768 */
-  WF_ICON_UNDER_TEXT			= (1<<17),	/* 65536 */
-  WF_ICON_CENTER			= (1<<18),	/* 131072 */
-  WF_ICON_CENTER_RIGHT			= (1<<19),	/* 262144 */
-  WF_RESTORE_BACKGROUND		= (1<<20),	/* 524288 */
-  WF_DRAW_FRAME_AROUND_WIDGET	 	= (1<<21),	/* 1048576 */
-  WF_DRAW_TEXT_LABEL_WITH_SPACE		= (1<<22),	/* 2097152 */
-  WF_WIDGET_HAS_INFO_LABEL		= (1<<23),	/* 4194304 */
-  WF_SELLECT_WITHOUT_BAR		= (1<<24),	/* 8388608 */
-  WF_PASSWD_EDIT			= (1<<25),
-  WF_EDIT_LOOP= (1<<26)
+  WF_HIDDEN= (1<<10),
+  /* widget->gfx may be freed together with the widget */
+  WF_FREE_GFX	 			= (1<<11),
+  /* widget->theme may be freed  together with the widget*/
+  WF_FREE_THEME= (1<<12),
+  /* widget->theme2 may be freed  together with the widget*/
+  WF_FREE_THEME2= (1<<13)  
+  /* widget->string may be freed  together with the widget*/
+  WF_FREE_STRING			= (1<<14),
+  /* widget->data may be freed  together with the widget*/
+  WF_FREE_DATA			 	= (1<<15),
+  /* widget->private_data may be freed  together with the widget*/
+  WF_FREE_PRIVATE_DATA			= (1<<16),
+  WF_ICON_ABOVE_TEXT			= (1<<17),
+  WF_ICON_UNDER_TEXT			= (1<<18),
+  WF_ICON_CENTER			= (1<<19),
+  WF_ICON_CENTER_RIGHT			= (1<<20),
+  WF_RESTORE_BACKGROUND	= (1<<21),
+  WF_DRAW_FRAME_AROUND_WIDGET	 	= (1<<22),
+  WF_DRAW_TEXT_LABEL_WITH_SPACE		= (1<<23),
+  WF_WIDGET_HAS_INFO_LABEL		= (1<<24),
+  WF_SELLECT_WITHOUT_BAR		= (1<<25),
+  WF_PASSWD_EDIT			= (1<<26),
+  WF_EDIT_LOOP= (1<<27)
 };
 
 /* Widget states */
Index: client/gui-sdl/widget_core.c
===
--- client/gui-sdl/widget_core.c	(Revision 12603)
+++ client/gui-sdl/widget_core.c	(Arbeitskopie)
@@ -105,6 +105,9 @@
   FREESURFACE(pGUI->theme);
 }
   }
+  if ((get_wflags(pGUI) & WF_FREE_THEME2) == WF_FREE_THEME2) {
+FREESURFACE(pGUI->theme2);
+  }
   if ((get_wflags(pGUI) & WF_FREE_DATA) == WF_FREE_DATA) {
 FC_FREE(pGUI->data.ptr);
   }
Index: client/gui-sdl/widget_checkbox.c
===
--- client/gui-sdl/widget_checkbox.c	(Revision 12603)
+++ client/gui-sdl/widget_checkbox.c	(Arbeitskopie)
@@ -17,6 +17,9 @@
 
 #include 
 
+/* utility */
+#include "log.h"
+
 /* gui-sdl */
 #include "colors.h"
 #include "graphics.h"
@@ -26,7 +29,8 @@
 #include "widget.h"
 #include "widget_p.h"
 
-static int (*baseclass_redraw)(struct widget *pwidget);
+static int (*ch

[Freeciv-Dev] (PR#35373) [SDL] city options panel crashbug

2007-02-07 Thread Daniel Markstedt

http://bugs.freeciv.org/Ticket/Display.html?id=35373 >

SDL client on recent 2.1.99-devel:

The city options panel is garbled and on access randomly crashes the
client with:

1: Unable to create Sprite (Surface) of size 794636 x 819204 16 Bits in
format 0

Program received signal EXC_BAD_ACCESS, Could not access memory.
SDL_DisplayFormatAlpha (surface=0x0) at src/video/SDL_video.c:984
984 src/video/SDL_video.c: No such file or directory.
in src/video/SDL_video.c


 ~Daniel
<>
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev