GNOME Bugzilla – Bug 74126
hangs when used with threads
Last modified: 2011-02-04 16:09:36 UTC
I've written a simple application which creates a tree view, fills it and shows it. When running without gtk_thread_init all runs fine. When running with gtk_thread_init the program hangs. I've changed the thread_enter/leave code in a way to make it easier for debugging and found that gtktreeview tries to obtain the lock a second time which leads to hanging. After changing the call to use the function without locking again it runs fine. diff -urN -X gtk+-2.0.0-dontdiff gtk+-2.0.0-vanilla/gtk/gtktreeview.c gtk+-2.0.0/gtk/gtktreeview.c --- gtk+-2.0.0-vanilla/gtk/gtktreeview.c Fri Mar 8 20:26:59 2002 +++ gtk+-2.0.0/gtk/gtktreeview.c Sun Mar 10 10:01:52 2002 @@ -261,6 +261,7 @@ GtkTreePath *path); static void validate_visible_area (GtkTreeView *tree_view); static gboolean validate_rows_handler (GtkTreeView *tree_view); +static gboolean do_validate_rows (GtkTreeView *tree_view); static gboolean presize_handler_callback (gpointer data); static void install_presize_handler (GtkTreeView *tree_view); static void gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view); @@ -1482,7 +1483,7 @@ /* we validate 50 rows initially just to make sure we have some size */ /* in practice, with a lot of static lists, this should get a good width */ - validate_rows_handler (tree_view); + do_validate_rows (tree_view); gtk_tree_view_size_request_columns (tree_view); gtk_tree_view_update_size (GTK_TREE_VIEW (widget));
Created attachment 7078 [details] The program to test the bug.
Created attachment 7079 [details] [review] A patch which lets the program run again, but perhaps breaks other things :-)
Just checked with the X11 engine. It has the same behavior. I used the gtk+-2.0.0 sources for testing in both cases (directfb and x11 engine).
Good catch! Just committed this to CVS. Thanks for patch.