GNOME Bugzilla – Bug 525794
GailTextView should avoid use GDK_THREADS_ENTER/LEAVE when not neccesary
Last modified: 2008-04-03 08:17:39 UTC
Please describe the problem: I detected this problem on modest (maemo/gnome email client) GailTextView has a func called insert_idle_handler. This name point to a function used on a idle, so the func uses GDK_THREADS_ENTER and GDK_THREADS_LEAVE as the idle is called out the global lock. The problem is that this function is used along the code outside a idle, which can causes a hang due a recursive lock, and in fact, as I said, I detected this problem on modest, although this could be the source of more future problems on other apps. Steps to reproduce: Preconditions: Configure an account in Modest Have the accessibility configured properly Steps 1. Launch Modest 2. Goto , Menu -> Email -> New -> Message 3. Try to enter any text in either To: , Cc: or Bcc text box Actual results: Modest hangs Expected results: Be able to write on this fields Does this happen every time? Yes Other information: Modest can be relatively tricky to compile and run on the gnome desktop, as at this moment they are more focused on the maemo version. I will try to reproduce this bug in other applications.
Created attachment 108480 [details] [review] Fixes the bug This patch fixes the bug by refactoring the function insert_idle_handler. Now there are two functions: * insert_handler: has the same functionality that the previous insert_idle_handler but removes the GDK_THREADS_ENTER/LEAVE * insert_idle_handler: calls insert_handler, but protected with GDK_THREADS_ENTER/LEAVE So insert_handler is used when the code its not used on a idle, and insert_idle_handler when it is used, as the idle funcs are outside the global lock
Are you using 2.22 or lower version of GNOME? I found the problem in gail. From GNOME 2.23, gail is merged into Gtk+, seems someone (probably chpe) removed the lock functions in Gtk+. But there are no lock in insert_idle_handler now, I think we need to add a function just like what you did in your patch.
Oh, sorry, from http://library.gnome.org/devel/gdk/stable/gdk-Threads.html#gdk-threads-add-idle-full, we can just remove the lock functions.
Most of the patch looks OK, we should return FALSE in insert_idle_handler.
Created attachment 108524 [details] [review] updated patch
(In answer to comment #2) I were using the gail version directly from the gail repository, withour realizing that now gail is inside the gtk+ repository. The only thing I don't understand is the comment #5. In the end it is necessary to apply it? As I understand after comment #3 and reading the code, gdk-threads-add-idle solves this issue.
Yes, I apply the patch to the gnome 2.22 branch of gail.