Re: [Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-09-20 Thread Marko Lindqvist

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

 This patch rearranges Freeciv code so that gcc -bug should not be
triggered. Seems to work for me.
 I'll test and commit tomorrow.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/wldlg.c freeciv/client/gui-gtk-2.0/wldlg.c
--- freeciv/client/gui-gtk-2.0/wldlg.c	2007-08-13 22:23:46.0 +0300
+++ freeciv/client/gui-gtk-2.0/wldlg.c	2007-09-21 09:47:47.0 +0300
@@ -1034,46 +1034,51 @@
 
   static bool titles_done;
   gint i;
-
+  GtkCellRenderer *rend;
+  GtkTreeViewColumn *col;
 
   intl_slist(ARRAY_SIZE(titles), titles, &titles_done);
 
-  for (i = 0; i < ARRAY_SIZE(titles); i++) {
-GtkCellRenderer *rend;
-GtkTreeViewColumn *col;
+  /* Case i == 0 taken out of the loop to workaround gcc-4.2.1 bug
+   * http://gcc.gnu.org/PR33381
+   * Some values would 'stick' from i == 0 round. */
+  i = 0;
 
-if (i == 0) {
-  rend = gtk_cell_renderer_pixbuf_new();
+  rend = gtk_cell_renderer_pixbuf_new();
 
-  gtk_tree_view_insert_column_with_data_func(view,
-	  i, titles[i], rend, cell_render_func, ppcity, NULL);
-  col = gtk_tree_view_get_column(view, i);
+  gtk_tree_view_insert_column_with_data_func(view,
+   i, titles[i], rend, cell_render_func, ppcity, NULL);
+  col = gtk_tree_view_get_column(view, i);
 
-  if (show_task_icons) {
-	if (max_unit_width == -1 || max_unit_height == -1) {
-	  update_max_unit_size();
-	}
-  } else {
-	g_object_set(col, "visible", FALSE, NULL);
-  }
-} else {
-  gint pos = i-1;
+  if (show_task_icons) {
+if (max_unit_width == -1 || max_unit_height == -1) {
+  update_max_unit_size();
+}
+  } else {
+g_object_set(col, "visible", FALSE, NULL);
+  }
+  if (show_task_icons) {
+g_object_set(rend, "height", max_unit_height, NULL);
+  }
 
-  rend = gtk_cell_renderer_text_new();
-  g_object_set_data(G_OBJECT(rend), "column", GINT_TO_POINTER(pos));
+  for (i = 1; i < ARRAY_SIZE(titles); i++) {
 
-  gtk_tree_view_insert_column_with_data_func(view,
-	  i, titles[i], rend, cell_render_func, ppcity, NULL); 
-  col = gtk_tree_view_get_column(view, i);
+gint pos = i-1;
 
-  if (pos >= 2) {
-	g_object_set(G_OBJECT(rend), "xalign", 1.0, NULL);
-	gtk_tree_view_column_set_alignment(col, 1.0);
-  }
+rend = gtk_cell_renderer_text_new();
+g_object_set_data(G_OBJECT(rend), "column", GINT_TO_POINTER(pos));
 
-  if (pos == 3) {
-	*pcol = col;
-  }
+gtk_tree_view_insert_column_with_data_func(view,
+	i, titles[i], rend, cell_render_func, ppcity, NULL); 
+col = gtk_tree_view_get_column(view, i);
+
+if (pos >= 2) {
+  g_object_set(G_OBJECT(rend), "xalign", 1.0, NULL);
+  gtk_tree_view_column_set_alignment(col, 1.0);
+}
+
+if (pos == 3) {
+  *pcol = col;
 }
 if (show_task_icons) {
   g_object_set(rend, "height", max_unit_height, NULL);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-09-20 Thread Daniel Markstedt

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

FYI: This bug is also discussed here
https://bugzilla.novell.com/show_bug.cgi?id=300410

 ~Daniel

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


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-08-15 Thread Guest

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

> [EMAIL PROTECTED] - Sun Jul 15 19:27:03 2007]:
> 
> Pre Scriptum: Two guys weren't able to reproduce this on different
> distros
> (Gentoo and another Gentoo), so this might be connected to my 
building
> environment on Arch Linux.
> 
> The problem:
> Segfault when founding a city (it probably tries to display the
> dialogue, but
> fails.
> 
> The environment:
> Arch Linux (2 different boxes)
> KDE (also happens with absolutely no WM in VNC)
> GTK2 client (doesn't happen with SDL client)
> 
> The build:
> branches/S2_1, revision 13105
> 
> The trace:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1219548976 (LWP 7814)]
> 0xb777d0d3 in strlen () from /lib/libc.so.6
> (gdb) bt full
> #0  0xb777d0d3 in strlen () from /lib/libc.so.6
> No symbol table info available.
> #1  0xb79ba09e in g_strdup () from /usr/lib/libglib-2.0.so.0
> No symbol table info available.
> #2  0xb7a3ce4a in value_collect_string () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #3  0xb7a1da16 in g_object_set_valist () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #4  0xb7a1df76 in g_object_set () from /usr/lib/libgobject-2.0.so.0
> No symbol table info available.
> #5  0x0812819c in cell_render_func (col=0x8da5640, rend=0xc508958,
> model=0xadc1dd0, it=0xbf860e84, data=0xc6b20f4) at wldlg.c:1011
> buf = {
>   "[EMAIL PROTECTED]",
>   "\000\206��\024\000\000\000`\220'[EMAIL PROTECTED],
> \r\206�\000\000\000\000�\f\206",
> "[EMAIL PROTECTED]@zP\fd\r\206��\027&[EMAIL PROTECTED]",
>   "[EMAIL PROTECTED]@�d\fX\211P\f\030\r\206"}
> i = 
> plr = 
> row = {0xbf860bec "Kasarmud", 0xbf860c2c "", 
0xbf860c6c "30",
> 0xbf860cac "30"}
> useless = 
> cid = 3
> target = {is_unit = 88, value = 3}
> #6  0xb7e44eff in gtk_tree_view_column_cell_set_cell_data ()
> from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #7  0xb7e29ed1 in validate_row () from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #8  0xb7e2e2ae in do_validate_rows () from /usr/lib/libgtk-x11-
> 2.0.so.0
> No symbol table info available.
> #9  0xb7e3753e in gtk_tree_view_size_request ()
> from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #10 0xb7a23799 in g_cclosure_marshal_VOID__BOXED ()
> from /usr/lib/libgobject-2.0.so.0
> No symbol table info available.
> #11 0xb7a15659 in g_type_class_meta_marshal ()
> from /usr/lib/libgobject-2.0.so.0
> No symbol table info available.
> #12 0xb7a16f2c in g_closure_invoke () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> ---Type  to continue, or q  to quit---
> #13 0xb7a27cb4 in signal_emit_unlocked_R () 
from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #14 0xb7a28d37 in g_signal_emit_valist () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #15 0xb7a2b45e in g_signal_emit_by_name () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #16 0xb7da5516 in do_size_request () 
from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #17 0xb7da5536 in compute_base_dimension () 
from /usr/lib/libgtk-x11-
> 2.0.so.0
> No symbol table info available.
> #18 0xb7da561d in compute_dimension () from /usr/lib/libgtk-x11-
> 2.0.so.0
> No symbol table info available.
> #19 0xb7da571e in _gtk_size_group_compute_requisition ()
> from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #20 0xb7e58d1c in gtk_widget_size_request () 
from /usr/lib/libgtk-x11-
> 2.0.so.0
> No symbol table info available.
> #21 0xb7d9a01f in gtk_scrolled_window_size_request ()
> from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #22 0xb7a23799 in g_cclosure_marshal_VOID__BOXED ()
> from /usr/lib/libgobject-2.0.so.0
> No symbol table info available.
> #23 0xb7a15659 in g_type_class_meta_marshal ()
> from /usr/lib/libgobject-2.0.so.0
> No symbol table info available.
> #24 0xb7a16f2c in g_closure_invoke () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #25 0xb7a27cb4 in signal_emit_unlocked_R () 
from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #26 0xb7a28d37 in g_signal_emit_valist () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #27 0xb7a2b45e in g_signal_emit_by_name () from /usr/lib/libgobject-
> 2.0.so.0
> No symbol table info available.
> #28 0xb7da5516 in do_size_request () 
from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #29 0xb7da574a in _gtk_size_group_compute_requisition ()
> from /usr/lib/libgtk-x11-2.0.so.0
> No symbol table info available.
> #30 0xb7e58d1c in gtk_widget_size_request () 
from /usr/lib/libgtk-x11-
> 2.0.so.0
> No symbol table info available.
> #31 0xb7dbfa13 in gtk_table_size_request () 
from /usr/lib/libgtk-x11-
> 2.0.so.0
> ---Type  to continue, or q  to quit---
> No symb

Re: [Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-20 Thread Elmo Todurov

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

Some more testing proved that
-O2 results in a segfault on city window popup,
-O1 doesn't,
-fschedule-insns results in a compile error.
My gcc:
gcc (GCC) 4.2.1 20070704 (prerelease)



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


Re: [Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-20 Thread Elmo Todurov

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

> gcc 4.x miscompiles gtk producing strange crashes that seem to originate
> in libc (strlen). I don't know if there are some special compiler
> switches one can use to make gcc 4 compile without this bug; the
> problem goes away if you compile gtk (and glib, etc.) with gcc 3.x
> (tested with gcc 3.4.6 gtk 2.10.13 glib 2.12.12). Hope that helps.

My tests show that you're wrong. Compiling gtk2 and glib2 with gcc-3.3 didn't 
change anything. On the other hand, compiling FreeCiv with gcc-3.3 seems to 
fix or work around the bug.



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


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-17 Thread Guest

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

> [EMAIL PROTECTED] - Tue Jul 17 19:56:51 2007]:
> 
> http://bugs.freeciv.org/Ticket/Display.html?id=39459 >
> 
> Some debugging says that the faulty place is
> client/gui-gtk-2.0/wldlg.c
> function cell_render_func
> line 1008 (this might change because of commits to SVN):
> column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(rend), 
"column"));
> column is set to -1 and this makes this code segfault:
> g_object_set(rend, "text", row[column], NULL);
> It might be that my GTK2 is bad..  How to check?
> 
> 
> 

gcc 4.x miscompiles gtk producing strange crashes that seem to originate
in libc (strlen). I don't know if there are some special compiler
switches one can use to make gcc 4 compile without this bug; the
problem goes away if you compile gtk (and glib, etc.) with gcc 3.x
(tested with gcc 3.4.6 gtk 2.10.13 glib 2.12.12). Hope that helps.

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


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-17 Thread Guest

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

> [EMAIL PROTECTED] - Tue Jul 17 19:56:51 2007]:
> 
> http://bugs.freeciv.org/Ticket/Display.html?id=39459 >
> 
> Some debugging says that the faulty place is
> client/gui-gtk-2.0/wldlg.c
> function cell_render_func
> line 1008 (this might change because of commits to SVN):
> column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(rend), 
"column"));
> column is set to -1 and this makes this code segfault:
> g_object_set(rend, "text", row[column], NULL);
> It might be that my GTK2 is bad..  How to check?
> 
> 
> 

gcc 4.x miscompiles gtk producing strange crashes that seem to originate
in libc (strlen). I don't know if there are some special compiler
switches one can use to make gcc 4 compile without this bug; the
problem goes away if you compile gtk (and glib, etc.) with gcc 3.x
(tested with gcc 3.4.6 gtk 2.10.13 glib 2.12.12). Hope that helps.

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


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-17 Thread Guest

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

I have the exact same problem, running Arch also.

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


Re: [Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-17 Thread Elmo Todurov

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

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

Some debugging says that the faulty place is
client/gui-gtk-2.0/wldlg.c
function cell_render_func
line 1008 (this might change because of commits to SVN):
column = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(rend), "column"));
column is set to -1 and this makes this code segfault:
g_object_set(rend, "text", row[column], NULL);
It might be that my GTK2 is bad..  How to check?



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


[Freeciv-Dev] (PR#39459) Segfault when founding a city

2007-07-15 Thread Elmo Todurov

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

Pre Scriptum: Two guys weren't able to reproduce this on different distros 
(Gentoo and another Gentoo), so this might be connected to my building 
environment on Arch Linux.

The problem:
Segfault when founding a city (it probably tries to display the dialogue, but 
fails.

The environment:
Arch Linux (2 different boxes)
KDE (also happens with absolutely no WM in VNC)
GTK2 client (doesn't happen with SDL client)

The build:
branches/S2_1, revision 13105

The trace:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1219548976 (LWP 7814)]
0xb777d0d3 in strlen () from /lib/libc.so.6
(gdb) bt full
#0  0xb777d0d3 in strlen () from /lib/libc.so.6
No symbol table info available.
#1  0xb79ba09e in g_strdup () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#2  0xb7a3ce4a in value_collect_string () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#3  0xb7a1da16 in g_object_set_valist () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#4  0xb7a1df76 in g_object_set () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#5  0x0812819c in cell_render_func (col=0x8da5640, rend=0xc508958, 
model=0xadc1dd0, it=0xbf860e84, data=0xc6b20f4) at wldlg.c:1011
buf = {
  "[EMAIL PROTECTED]",
  "\000\206��\024\000\000\000`\220'[EMAIL PROTECTED],
\r\206�\000\000\000\000�\f\206", "[EMAIL 
PROTECTED]@zP\fd\r\206��\027&[EMAIL PROTECTED]",
  "[EMAIL PROTECTED]@�d\fX\211P\f\030\r\206"}
i = 
plr = 
row = {0xbf860bec "Kasarmud", 0xbf860c2c "", 0xbf860c6c "30", 
0xbf860cac "30"}
useless = 
cid = 3
target = {is_unit = 88, value = 3}
#6  0xb7e44eff in gtk_tree_view_column_cell_set_cell_data () 
from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#7  0xb7e29ed1 in validate_row () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#8  0xb7e2e2ae in do_validate_rows () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#9  0xb7e3753e in gtk_tree_view_size_request () 
from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#10 0xb7a23799 in g_cclosure_marshal_VOID__BOXED () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#11 0xb7a15659 in g_type_class_meta_marshal () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#12 0xb7a16f2c in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
---Type  to continue, or q  to quit---
#13 0xb7a27cb4 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#14 0xb7a28d37 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#15 0xb7a2b45e in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#16 0xb7da5516 in do_size_request () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#17 0xb7da5536 in compute_base_dimension () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#18 0xb7da561d in compute_dimension () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#19 0xb7da571e in _gtk_size_group_compute_requisition () 
from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#20 0xb7e58d1c in gtk_widget_size_request () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#21 0xb7d9a01f in gtk_scrolled_window_size_request () 
from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#22 0xb7a23799 in g_cclosure_marshal_VOID__BOXED () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#23 0xb7a15659 in g_type_class_meta_marshal () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#24 0xb7a16f2c in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#25 0xb7a27cb4 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#26 0xb7a28d37 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#27 0xb7a2b45e in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#28 0xb7da5516 in do_size_request () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#29 0xb7da574a in _gtk_size_group_compute_requisition () 
from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#30 0xb7e58d1c in gtk_widget_size_request () from /usr/lib/libgtk-x11-2.0.so.0
No symbol table info available.
#31 0xb7dbfa13 in gtk_table_size_request () from /usr/lib/libgtk-x11-2.0.so.0
---Type  to continue, or q  to quit---
No symbol table info available.
#32 0xb7a23799 in g_cclosure_marshal_VOID__BOXED () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#33 0xb7a15659 in g_type_class_meta_marshal () 
from /usr/lib/libgobject-2.0.so.0
No symbol table info available.
#34 0xb7a16f2c in g_closure_invoke () from /usr/lib/libgobj