After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 525794 - GailTextView should avoid use GDK_THREADS_ENTER/LEAVE when not neccesary
GailTextView should avoid use GDK_THREADS_ENTER/LEAVE when not neccesary
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: gail
1.22.x
Other All
: Normal normal
: ---
Assigned To: Li Yuan
Li Yuan
Depends on:
Blocks:
 
 
Reported: 2008-04-02 16:51 UTC by Alejandro Piñeiro Iglesias (IRC: infapi00)
Modified: 2008-04-03 08:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes the bug (2.10 KB, patch)
2008-04-02 17:00 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
none Details | Review
updated patch (2.74 KB, patch)
2008-04-03 06:34 UTC, Li Yuan
committed Details | Review

Description Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-04-02 16:51:33 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.
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-04-02 17:00:25 UTC
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
Comment 2 Li Yuan 2008-04-03 02:35:33 UTC
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.
Comment 3 Li Yuan 2008-04-03 02:43:29 UTC
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.
Comment 4 Li Yuan 2008-04-03 06:20:40 UTC
Most of the patch looks OK, we should return FALSE in insert_idle_handler.
Comment 5 Li Yuan 2008-04-03 06:34:54 UTC
Created attachment 108524 [details] [review]
updated patch
Comment 6 Alejandro Piñeiro Iglesias (IRC: infapi00) 2008-04-03 08:12:23 UTC
(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.
Comment 7 Li Yuan 2008-04-03 08:17:39 UTC
Yes, I apply the patch to the gnome 2.22 branch of gail.