Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] (PR#15197) SDL client: crash in nations selection dialog
Home

[Freeciv-Dev] (PR#15197) SDL client: crash in nations selection dialog

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: himasaram@xxxxxxxx
Subject: [Freeciv-Dev] (PR#15197) SDL client: crash in nations selection dialog
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Tue, 17 Jan 2006 22:55:14 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15197 >

> [dmarks - Mi 18. Jan 2006, 00:04:50]:
> 
> I randomly clicked to and fro between two nations a few times, and the
> client crashed on me with:
> 
> 1: Unable to create Sprite (Surface) of size 59369 x 59369 0 Bits in
> format 0
> Segmentation fault
> 
> Non-reproducible.
> 
> 
> However there are another sprite-related bug that might be related to
> this crash: When you first enter the dialog, the flag on the right
> initially displayed looks fine, but when you start selecting other
> nations, one of the colors of every flag displayed there becomes
> transparent.
> 
> To reproduce, just enter the pregame dialog with an SDL client, click
> Select Nation and start clicking on different nations.
> 
> -Daniel
> 

Here's a patch. It fixes the transparency bug and hopefully the crash
bug, too.
Index: client/gui-sdl/dialogs.c
===================================================================
--- client/gui-sdl/dialogs.c    (Revision 11468)
+++ client/gui-sdl/dialogs.c    (Arbeitskopie)
@@ -3997,17 +3997,20 @@
   struct NAT *pSetup = (struct NAT *)(pWindow->data.ptr);  
   struct GUI *pLabel = pSetup->pName_Edit->next;
   struct nation_type *pNation = get_nation_by_idx(pSetup->nation);
-  
-  pTmp_Surf = make_flag_surface_smaler(GET_SURF(get_nation_flag_sprite(tileset,
+    
+  pTmp_Surf = adj_surf(GET_SURF(get_nation_flag_sprite(tileset,
                                        get_nation_by_idx(pSetup->nation))));
-  pTmp_Surf_zoomed = ZoomSurface(pTmp_Surf, 1.0, 1.0, 1);
-  SDL_SetColorKey(pTmp_Surf_zoomed, SDL_SRCCOLORKEY|SDL_RLEACCEL,
-               getpixel(pTmp_Surf_zoomed, pTmp_Surf_zoomed->w - 1,
-                                               pTmp_Surf_zoomed->h - 1));
+  pTmp_Surf_zoomed = ZoomSurface(pTmp_Surf, 1.0, 1.0, 1);  
+
+/* only free the flag sprite if it is a copy created by the adj_surf() macro */
+#ifdef SMALL_SCREEN
   FREESURFACE(pTmp_Surf);
+#endif
+  
   FREESURFACE(pLabel->theme);
+  pLabel->theme = pTmp_Surf_zoomed;
+  SDL_SetAlpha(pLabel->theme, 0, 0);
   
-  pLabel->theme = pTmp_Surf_zoomed;
   copy_chars_to_string16(pLabel->string16, Q_(pNation->name_plural));
   
   remake_label_size(pLabel);

[Prev in Thread] Current Thread [Next in Thread]