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: Fri, 13 Dec 2002 02:10:47 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Thu, Dec 12, 2002 at 06:15:47PM -0800, mwlucas@xxxxxxxxxxxxxxxxxxxx via RT 
wrote:
> pedicular~/civ;../civsrc/freeciv-1.13.0/civ -a
> 1: Cannot find audio spec-file "stdsounds.spec".
> 1: To get sound you need to download a sound set!
> 1: Get sound sets from <ftp://ftp.freeciv.org/freeciv/contrib/sounds/sets>.
> 1: Will continue with disabled sounds.
> base_popup_message_dialog: OK
> base: buttons=8, name='Unit Commands', text='Warriors
> Fortifying
> Haarlem'
> popup_mes_handle_callback #1: OK
> calling callback 0x8078eb0 of button 1 with 0x6b
> popup_mes_handle_callback #2: BAD
> popup_mes_close: BAD
> Bus error (core dumped)
> pedicular~/civ;cd ../civsrc/freeciv-1.13.0
> pedicular~/civsrc/freeciv-1.13.0;nm client/civclient | grep 8078eb0
> 08078eb0 t present_unit_activate_close_callback
> pedicular~/civsrc/freeciv-1.13.0;

Current guess:
 - the parent is the city dialog
 - present_unit_activate_close_callback closes the city dialog
 - popup_mes_close tests for the parent, but the parent pointer is
 dangling

It this is true you should only be able to reproduce this if you click
on an action which closes the city dialog. Yes/No?

Please test the test.diff and report the output. Than please test
fix.diff. It should solve the problem.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "There are three ways to get something done. Do it yourself, hire someone
  to do it for you or forbid your kids to do it."

Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.147
diff -u -u -r1.147 citydlg.c
--- client/gui-gtk/citydlg.c    2002/12/05 22:22:34     1.147
+++ client/gui-gtk/citydlg.c    2002/12/13 09:59:19
@@ -2653,12 +2653,21 @@
   struct city *pcity;
   struct city_dialog *pdialog;
 
+  CHECK("present_unit_activate_close_callback#1");
   if ((punit = player_find_unit_by_id(game.player_ptr, (size_t) data))) {
+    CHECK("present_unit_activate_close_callback#2");
     activate_unit(punit);
-    if ((pcity = map_get_city(punit->x, punit->y)))
-      if ((pdialog = get_city_dialog(pcity)))
+    CHECK("present_unit_activate_close_callback#3");
+    if ((pcity = map_get_city(punit->x, punit->y))) {
+      CHECK("present_unit_activate_close_callback#4");
+      if ((pdialog = get_city_dialog(pcity))) {
+       CHECK("present_unit_activate_close_callback#5");
        close_city_dialog(pdialog);
+       CHECK("present_unit_activate_close_callback#6");
+      }
+    }
   }
+  CHECK("present_unit_activate_close_callback#7");
 }
 
 /****************************************************************
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/13 09:59:24
@@ -51,6 +51,8 @@
 
 #include "dialogs.h"
 
+GtkTypeObject *fc_parent;
+
 /******************************************************************/
 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("popup_mes_close");
+
   if (GTK_IS_WIDGET(parent)) {
     /* 
      * It is possible that the user callback for a button may have
@@ -1473,7 +1477,6 @@
   void (*close_callback) (gpointer) =
       (void (*)(gpointer)) gtk_object_get_data(GTK_OBJECT(dialog_shell),
                                               "close_callback");
-
   if (close_callback) {
     popup_mes_close(dialog_shell);
     return FALSE;
@@ -1493,8 +1496,12 @@
   struct button_descr *buttons =
       gtk_object_get_data(GTK_OBJECT(dialog_shell), "buttons");
 
+  CHECK("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("popup_mes_handle_callback #2");
   }
 
   popup_mes_close(dialog_shell);
@@ -1538,6 +1545,11 @@
   GtkAccelGroup *accel = gtk_accel_group_new();
   int i;
 
+  fc_parent = (GtkTypeObject *) parent;
+
+  CHECK("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);
Index: client/gui-gtk/dialogs.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.h,v
retrieving revision 1.9
diff -u -u -r1.9 dialogs.h
--- client/gui-gtk/dialogs.h    2002/12/01 22:49:24     1.9
+++ client/gui-gtk/dialogs.h    2002/12/13 09:59:24
@@ -13,9 +13,15 @@
 #ifndef FC__DIALOGS_H
 #define FC__DIALOGS_H
 
+#include <stdio.h>
+
 #include <gtk/gtk.h>
 
 #include "dialogs_g.h"
+
+#define CHECK(msg) printf("%s: 
%s\n",msg,(fc_parent->klass==(void*)0xd0d0d0d0)?"BAD":"OK")
+
+extern GtkTypeObject *fc_parent;
 
 struct tile;
 
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.147
diff -u -u -r1.147 citydlg.c
--- client/gui-gtk/citydlg.c    2002/12/05 22:22:34     1.147
+++ client/gui-gtk/citydlg.c    2002/12/13 10:08:39
@@ -2653,12 +2653,21 @@
   struct city *pcity;
   struct city_dialog *pdialog;
 
+  CHECK("present_unit_activate_close_callback#1");
   if ((punit = player_find_unit_by_id(game.player_ptr, (size_t) data))) {
+    CHECK("present_unit_activate_close_callback#2");
     activate_unit(punit);
-    if ((pcity = map_get_city(punit->x, punit->y)))
-      if ((pdialog = get_city_dialog(pcity)))
+    CHECK("present_unit_activate_close_callback#3");
+    if ((pcity = map_get_city(punit->x, punit->y))) {
+      CHECK("present_unit_activate_close_callback#4");
+      if ((pdialog = get_city_dialog(pcity))) {
+       CHECK("present_unit_activate_close_callback#5");
        close_city_dialog(pdialog);
+       CHECK("present_unit_activate_close_callback#6");
+      }
+    }
   }
+  CHECK("present_unit_activate_close_callback#7");
 }
 
 /****************************************************************
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/13 10:08:44
@@ -51,6 +51,8 @@
 
 #include "dialogs.h"
 
+GtkTypeObject *fc_parent;
+
 /******************************************************************/
 static gint popup_mes_del_callback(GtkWidget *widget, GdkEvent *event,
                                   gpointer data);
@@ -1448,13 +1450,14 @@
   struct button_descr *buttons =
       gtk_object_get_data(GTK_OBJECT(dialog_shell), "buttons");
 
-  if (GTK_IS_WIDGET(parent)) {
-    /* 
-     * It is possible that the user callback for a button may have
-     * destroyed the parent.
-     */
-    gtk_widget_set_sensitive(parent, TRUE);
-  }
+  CHECK("popup_mes_close");
+
+  assert(GTK_IS_WIDGET(parent));
+  printf("object flags = %x, widget flags = %x\n",
+        GTK_OBJECT_FLAGS(GTK_OBJECT(parent)),
+        GTK_WIDGET_FLAGS(GTK_WIDGET(parent)));
+  gtk_widget_set_sensitive(parent, TRUE);
+  gtk_widget_unref(parent);
 
   if (close_callback) {
     (*close_callback)(close_callback_data);
@@ -1473,7 +1476,6 @@
   void (*close_callback) (gpointer) =
       (void (*)(gpointer)) gtk_object_get_data(GTK_OBJECT(dialog_shell),
                                               "close_callback");
-
   if (close_callback) {
     popup_mes_close(dialog_shell);
     return FALSE;
@@ -1493,8 +1495,12 @@
   struct button_descr *buttons =
       gtk_object_get_data(GTK_OBJECT(dialog_shell), "buttons");
 
+  CHECK("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("popup_mes_handle_callback #2");
   }
 
   popup_mes_close(dialog_shell);
@@ -1538,6 +1544,12 @@
   GtkAccelGroup *accel = gtk_accel_group_new();
   int i;
 
+  fc_parent = (GtkTypeObject *) parent;
+
+  gtk_widget_ref(parent);
+  CHECK("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);
Index: client/gui-gtk/dialogs.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.h,v
retrieving revision 1.9
diff -u -u -r1.9 dialogs.h
--- client/gui-gtk/dialogs.h    2002/12/01 22:49:24     1.9
+++ client/gui-gtk/dialogs.h    2002/12/13 10:08:44
@@ -13,9 +13,15 @@
 #ifndef FC__DIALOGS_H
 #define FC__DIALOGS_H
 
+#include <stdio.h>
+
 #include <gtk/gtk.h>
 
 #include "dialogs_g.h"
+
+#define CHECK(msg) printf("%s: 
%s\n",msg,(fc_parent->klass==(void*)0xd0d0d0d0)?"BAD":"OK")
+
+extern GtkTypeObject *fc_parent;
 
 struct tile;
 

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