Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] (PR#15203) SDL client: another crash in nation selection d
Home

[Freeciv-Dev] (PR#15203) SDL client: another crash in nation selection d

[Top] [All Lists]

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

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

> [dmarks - Mi 18. Jan 2006, 03:19:17]:
> 
> On Tue, 2006-01-17 at 18:51 -0800, Jason Short wrote:
> > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=15203 >
> > 
> > Daniel Markstedt wrote:
> > > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=15203 >
> > > 
> > > When browsing leader names using the left and right arrows, the client
> > > randomly segfaults. Sometimes is gives this error message instead:
> > > 
> > > civclient: gui_string.c:206: copy_chars_to_string16: Assertion
> > > `pCharString != ((void *)0)' failed.
> > > Aborted
> > > 
> > > Yet sometimes, the crash is preceded by the appearance of a 'blank'
> > > leader name.
> > 
> > Sounds like memory errors.  Try running under valgrind (if you're on 
> > x86/linux).
> > 
> > -jason
> 
> 
> Here is the output of a session that led up to a crash.
> 
> -Daniel
> 
> 

Here's a patch. The client crashed when the randomly selected default
leader was the first or last leader on the list and you clicked the
"wrong" button, because it had not been disabled.
Index: client/gui-sdl/dialogs.c
===================================================================
--- client/gui-sdl/dialogs.c    (Revision 11468)
+++ client/gui-sdl/dialogs.c    (Arbeitskopie)
@@ -4045,13 +4045,19 @@
   } else {
     copy_chars_to_string16(pSetup->pChange_Sex->string16, _("Female"));
   }
-  
+
+  /* disable navigation buttons */
+  set_wstate(pSetup->pName_Prev, FC_WS_DISABLED);
+  set_wstate(pSetup->pName_Next, FC_WS_DISABLED);
+
   if (dim > 1) {
-    if (pSetup->selected_leader) {
+    /* if selected leader is not the first leader, enable "previous leader" 
button */
+    if (pSetup->selected_leader > 0) {
       set_wstate(pSetup->pName_Prev, FC_WS_NORMAL);
     }
 
-    if ((dim - 1) != pSetup->selected_leader) {
+    /* if selected leader is not the last leader, enable "next leader" button 
*/
+    if (pSetup->selected_leader < (dim - 1)) {
       set_wstate(pSetup->pName_Next, FC_WS_NORMAL);
     }
   }

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