<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40743 >
> [book - Wed Mar 11 23:46:54 2009]: > > > [bjo...@gmail.com - Sat Mar 07 04:50:45 2009]: > > > > If no one else can reproduce it, it must be something wrong with my > > GTK (Turn done button doesn't blink). > > > > Ubuntu 8.10 > > checking for GTK+ - version >= 2.4.0... yes (version 2.14.4) > > I have confirmed the crash with gtk+-2.14.7. Investigating... The attached patch contains a somewhat hackish workaround for what would appear to be a bug caused by the omission of a NULL pointer check in the internal gtknotebook code (since gtk version 2.10): http://bugzilla.gnome.org/show_bug.cgi?id=477454 As far as I can tell my patch avoids the crash, though I am not 100% certain since I could only reproduce the original segfault sometimes (for some reason it would help to use amplio and the freeciv widget theme). I did try to make it crash more than 100 times though, so I am pretty certain that with the patch applied it should no longer occur. Please test under your configuration to see if this fixes the issue. ----------------------------------------------------------------------- 百パーセントは臆病者のだ。
diff --git a/client/gui-gtk-2.0/gui_main.c b/client/gui-gtk-2.0/gui_main.c index 519c46c..7394381 100644 --- a/client/gui-gtk-2.0/gui_main.c +++ b/client/gui-gtk-2.0/gui_main.c @@ -1097,6 +1097,29 @@ void enable_menus(bool enable) } /************************************************************************** + Workaround for a crash that occurs when a button release event is + emitted for a notebook with no pages. See PR#40743. + FIXME: Remove this hack once gtk_notebook_button_release() in + gtk/gtknotebook.c checks for NULL notebook->cur_page. +**************************************************************************/ +static gboolean right_notebook_button_release(GtkWidget *widget, + GdkEventButton *event) +{ + if (event->type != GDK_BUTTON_RELEASE) { + return FALSE; + } + + if (!GTK_IS_NOTEBOOK(widget) + || -1 == gtk_notebook_get_current_page(GTK_NOTEBOOK(widget))) { + /* Make sure the default gtk handler + * does NOT get called in this case. */ + return TRUE; + } + + return FALSE; +} + +/************************************************************************** do the heavy lifting for the widget setup. **************************************************************************/ static void setup_widgets(void) @@ -1445,6 +1468,8 @@ static void setup_widgets(void) g_object_ref(right_notebook); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(right_notebook), GTK_POS_TOP); gtk_notebook_set_scrollable(GTK_NOTEBOOK(right_notebook), TRUE); + g_signal_connect(right_notebook, "button-release-event", + G_CALLBACK(right_notebook_button_release), NULL); if (split_bottom_notebook) { gtk_paned_pack2(GTK_PANED(hpaned), right_notebook, TRUE, TRUE); }
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev