Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2534) civclient crash on FreeBSD 5.0
Home

[Freeciv-Dev] Re: (PR#2534) civclient crash on FreeBSD 5.0

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mwlucas@xxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2534) civclient crash on FreeBSD 5.0
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 12 Dec 2002 14:32:18 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Thu, Dec 12, 2002 at 02:03:52PM -0800, mwlucas@xxxxxxxxxxxxxxxxxxxx via RT 
wrote:
> On Thu, Dec 12, 2002 at 12:47:06PM -0800, Raimar Falke via RT wrote:
> > The reason can be a buggy compiler (we had such an issue, don't use a
> > CVS compiler), the OS, GTK or freeciv.
> 
> And if you point me at one of them, that's just fine. Thanks for your
> help!
> 
> Applied the patch (one piece didn't apply, but that was just
> whitespace.)
> 
> And if you wind up pointing me at one of those, it's fine.  
> 
> Same crash again, this time with error messages at the client side:
> 
> base_popup_message_dialog: OK
> popup_mes_handle_callback #1: OK
> popup_mes_handle_callback #2: BAD

This indicates that it is a freeciv problem. So lets see what function
is called and so corrupts the parent struct.

Apply the patch, make and run. You should get an output like:

$ ./civ -a
base_popup_message_dialog: OK
base: buttons=8, name='Befehle', text='Siedler
Züge: 1
'
popup_mes_handle_callback #1: OK
calling callback 0x8083f50 of button 0 with 0x66
popup_mes_handle_callback #2: OK
popup_mes_close: OK

Now use the address in a shell command like this:
 $ nm client/civclient | grep 8083f50
08083f50 t unit_activate_callback

Post the client and the grep output.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Understanding is a three-edged sword; 
  your side, their side, and the truth."
    -- a well-known Vorlon


Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.115
diff -u -u -r1.115 dialogs.c
--- client/gui-gtk/dialogs.c    2002/12/01 22:49:24     1.115
+++ client/gui-gtk/dialogs.c    2002/12/12 22:30:33
@@ -51,6 +51,8 @@
 
 #include "dialogs.h"
 
+#define CHECK(x, msg) printf("%s: %s\n",msg,(((GtkTypeObject 
*)x)->klass==(void*)0xd0d0d0d0)?"BAD":"OK")
+
 /******************************************************************/
 static gint popup_mes_del_callback(GtkWidget *widget, GdkEvent *event,
                                   gpointer data);
@@ -1448,6 +1450,8 @@
   struct button_descr *buttons =
       gtk_object_get_data(GTK_OBJECT(dialog_shell), "buttons");
 
+  CHECK(parent, "popup_mes_close");
+
   if (GTK_IS_WIDGET(parent)) {
     /* 
      * It is possible that the user callback for a button may have
@@ -1492,9 +1495,15 @@
        GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(widget), "button"));
   struct button_descr *buttons =
       gtk_object_get_data(GTK_OBJECT(dialog_shell), "buttons");
+  GtkWidget *parent =
+      gtk_object_get_data(GTK_OBJECT(dialog_shell), "parent");
 
+  CHECK(parent, "popup_mes_handle_callback #1");
   if (buttons[button].callback) {
+    printf("calling callback %p of button %d with %p\n",
+          buttons[button].callback, button, buttons[button].data);
     (*buttons[button].callback)(buttons[button].data);
+    CHECK(parent, "popup_mes_handle_callback #2");
   }
 
   popup_mes_close(dialog_shell);
@@ -1538,6 +1547,9 @@
   GtkAccelGroup *accel = gtk_accel_group_new();
   int i;
 
+  CHECK(parent, "base_popup_message_dialog");
+  printf("base: buttons=%d, name='%s', text='%s'\n", num_buttons, dialogname,
+        text);
   gtk_widget_set_sensitive(parent, FALSE);
   
   dshell=gtk_window_new(GTK_WINDOW_TOPLEVEL);

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