Hello community, here is the log from the commit of package gtk2 checked in at Sun May 21 19:03:03 CEST 2006. -------- --- GNOME/gtk2/gtk2.changes 2006-05-04 22:35:53.000000000 +0200 +++ gtk2/gtk2.changes 2006-05-17 18:31:50.000000000 +0200 @@ -1,0 +2,5 @@ +Wed May 17 18:24:32 CEST 2006 - bk@suse.de + +- GtkFontSelection: Fix deadlock when used by GtkFontButton (153099) + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gtk2.spec ++++++ --- /var/tmp/diff_new_pack.HvILi5/_old 2006-05-21 19:02:46.000000000 +0200 +++ /var/tmp/diff_new_pack.HvILi5/_new 2006-05-21 19:02:46.000000000 +0200 @@ -22,7 +22,7 @@ Requires: gnome-filesystem PreReq: /usr/bin/touch /bin/rm /bin/rmdir Version: 2.8.10 -Release: 37 +Release: 39 Summary: Library for Creation of Graphical User Interfaces Source: ftp://ftp.gnome.org/pub/GNOME/sources/gtk+/2.8/gtk+-%{version}.tar.bz2 Source1: SuSEconfig.gtk2 @@ -369,6 +369,8 @@ %{prefix}/share/gtk-doc/html/* %changelog -n gtk2 +* Wed May 17 2006 - bk@suse.de +- GtkFontSelection: Fix deadlock when used by GtkFontButton (153099) * Thu May 04 2006 - dobey@suse.de - Add in default gtkrc file to set theme/icon theme under KDE/etc Fixes https://bugzilla.novell.com/show_bug.cgi?id=172779 ++++++ gtk+-2.8.6-fontsel.patch ++++++ --- /var/tmp/diff_new_pack.HvILi5/_old 2006-05-21 19:02:47.000000000 +0200 +++ /var/tmp/diff_new_pack.HvILi5/_new 2006-05-21 19:02:47.000000000 +0200 @@ -1,3 +1,88 @@ +Patch updated on 17 May 2006 with this changelog: + +------------------------------------------------------------------- +Wed May 17 18:24:32 CEST 2006 - bk@suse.de + +- GtkFontSelection: Fix deadlock when used by GtkFontButton (153099) + +------------------------------------------------------------------- + +Story: + +In October 2005, +Bug 130159 - Improve scrolling speed of GtkFontSelection's font/style/size lists. +was opened for 10.1, with this description: + +--------------------------------------------------------------------------- +When selecting a new font,style or size in GtkFontSelection, the speed of +updating preview string is very slow, because creating information of a new +font +in pango/fontconfig is very slow. So it's very hard for users to scroll the +lists by cursors. + +The attached patch solves this issue by moving the font update code into an +async function. +--------------------------------------------------------------------------- + +Doing so also required that the now-async functions needed to take +the gdk_thread_mutex because GTK2 is NOT thread-safe. + +But the patch caused +Bug 153099 - segfaults detected in GtkFontSelection +to be found in Beta4. + +It was fixed by callying the new-async functions to be called +syncronously, in the sync case, they still took the gdk_thread_mutex, +despite that they may not do so then called syncronously, which +was the reason for the deadlock. + +Applications which did not initalze the 'thread-awareness' functionality +of GTK+ didn't cannot notice anything becuase the mutex is not used then. + +But a multithreaded application which uses GtkFontButton, which in +creates and initializes a GtkFontSelection dialog inside the on-click +handler of the button, kino-0.8.1, reproducibly caused GTK to deadlock: + +https://bugzilla.novell.com/show_bug.cgi?id=153099 + +The fix is to add for + ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) + +before doing + + GDK_THREADS_ENTER (); + +and + + GDK_THREADS_LEAVE (); + +Because in the second patch to fix the segfault, gtk+-2.8.6-fontsel-fix.patch, +this was done: + ++ immediate_selection = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (fontsel), "immediate-selection")); + ++ if (immediate_selection) ++ gtk_font_selection_real_select_font (data); + +(else, call it asyncrounusly, where the lock the function needs to take the lock) + +which means that in all cases where immediate_selection is set, the +gtk_font_selection_real_select_font/style/size functions have been called +syncronously and so thay may not call GDK_THREADS_ENTER () in this special +case, so the change + +-+ GDK_THREADS_ENTER (); +++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) +++ GDK_THREADS_ENTER (); + +was applied to the places where this patch previosly took the lock +unconditionally. + -- Bernhard Kaindl, 17 May 2006. + +The patches gtk+-2.8.6-fontsel.patch and gtk+-2.8.6-fontsel-fix.patch +should be merged with the next major update. + --- gtk/gtkfontsel.c.old 2005-10-22 13:31:09.000000000 +0800 +++ gtk/gtkfontsel.c 2005-10-22 23:34:41.000000000 +0800 @@ -591,11 +591,24 @@ @@ -25,7 +110,7 @@ if (fontsel->font) gdk_font_unref (fontsel->font); -@@ -674,16 +687,19 @@ +@@ -674,16 +687,20 @@ } /* This is called when a family is selected in the list. */ @@ -41,21 +126,23 @@ GtkTreeIter iter; const gchar *family_name; -+ GDK_THREADS_ENTER (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_ENTER (); + fontsel = GTK_FONT_SELECTION (data); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->family_list)); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { -@@ -706,6 +722,30 @@ +@@ -706,6 +722,31 @@ g_object_unref (family); } + + g_object_set_data (G_OBJECT (fontsel), "font-selection-timeout", GUINT_TO_POINTER (0)); + -+ GDK_THREADS_LEAVE (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_LEAVE (); + + /* Remove ourselves */ + return FALSE; @@ -79,7 +166,7 @@ } static int -@@ -908,14 +948,19 @@ +@@ -908,14 +948,20 @@ /* This is called when a style is selected in the list. */ @@ -95,7 +182,8 @@ GtkTreeModel *model; GtkTreeIter iter; -+ GDK_THREADS_ENTER (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_ENTER (); + + fontsel = GTK_FONT_SELECTION (data); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->face_list)); @@ -103,14 +191,15 @@ if (gtk_tree_selection_get_selected (selection, &model, &iter)) { PangoFontFace *face; -@@ -928,6 +973,30 @@ +@@ -928,6 +973,31 @@ gtk_font_selection_show_available_sizes (fontsel, FALSE); gtk_font_selection_select_best_size (fontsel); + + g_object_set_data (G_OBJECT (fontsel), "style-selection-timeout", GUINT_TO_POINTER (0)); + -+ GDK_THREADS_LEAVE (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_LEAVE (); + + /* Remove ourselves */ + return FALSE; @@ -134,7 +223,7 @@ } static void -@@ -1062,22 +1131,49 @@ +@@ -1062,22 +1131,51 @@ } /* This is called when a size is selected in the list. */ @@ -150,7 +239,8 @@ GtkTreeIter iter; gint new_size; -+ GDK_THREADS_ENTER (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_ENTER (); + fontsel = GTK_FONT_SELECTION (data); - @@ -164,7 +254,8 @@ + + g_object_set_data (G_OBJECT (fontsel), "size-selection-timeout", GUINT_TO_POINTER (0)); + -+ GDK_THREADS_LEAVE (); ++ if (!g_object_get_data (G_OBJECT (fontsel), "immediate-selection")) ++ GDK_THREADS_LEAVE (); + + /* Remove ourselves */ + return FALSE; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...