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 612066 - empathy hangs when clicked on information about contact with web link as status message
empathy hangs when clicked on information about contact with web link as stat...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkLabel
2.18.x
Other Linux
: High critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 612185
 
 
Reported: 2010-03-07 09:52 UTC by Omer Akram
Modified: 2010-03-08 16:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple test case (1.10 KB, text/plain)
2010-03-08 12:09 UTC, Xavier Claessens
  Details
Little GTK patch to add debug info (2.40 KB, patch)
2010-03-08 12:13 UTC, Xavier Claessens
none Details | Review

Description Omer Akram 2010-03-07 09:52:42 UTC
in the contact list if the user have a web link as status message and I right click on the contact and click information empathy will hang.
Comment 1 Omer Akram 2010-03-07 09:59:36 UTC
does not hang if the user have only web link as status message. If the status message contains some text and the weblink then empathy hangs
Comment 2 Omer Akram 2010-03-07 10:00:18 UTC
originally reported at: https://bugs.launchpad.net/ubuntu/+source/empathy/+bug/532947
Comment 3 Guillaume Desmottes 2010-03-08 09:11:53 UTC
If a contact has "Visit http://www.google.be yeah" has status, opening his information dialog hangs Empathy.
Comment 4 Omer Akram 2010-03-08 09:16:32 UTC
If text comes after web address empathy wont hang. In case of "Visit http://www.google.be yeah" empathy hangs
Comment 5 Xavier Claessens 2010-03-08 11:06:17 UTC
This is most probably GTK bug. I'm trying to write simple test case, but can't find one yet.

The infinite loop is when the dialog is searching for the focus widget, in gtk_dialog_map() there is a while(TRUE) with obscure exit condition that never happens in our case.

Reassign to GTK, they probably know better that code.
Comment 6 Xavier Claessens 2010-03-08 12:09:14 UTC
Created attachment 155550 [details]
Simple test case

Ok, here is a test case that freeze. That's the proof the bug is on GTK+.

Note that If I mode the gtk_widget_show (dialog); before packing labels, then it works.
Comment 7 Xavier Claessens 2010-03-08 12:13:12 UTC
Created attachment 155551 [details] [review]
Little GTK patch to add debug info

Those debug prints shows the infinite loop inside gtk_dialog_map().
Comment 8 Xavier Claessens 2010-03-08 12:14:04 UTC
Here is the output of the test case with the above patch applied:

1: first (nil) window (nil)
grab focus on 0x1a3c000
and has info 0x1a3c000
2: first (nil) window 0x1a3c000
3: is label 1
1: first 0x1a3c000 window 0x1a3c000
grab focus on 0x1a3c0d0
and has info 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
1: first 0x1a3c000 window 0x1a3c0d0
select link for 0x1a3c0d0
2: first 0x1a3c000 window 0x1a3c0d0
3: is label 1
**
Gtk:ERROR:gtkdialog.c:413:gtk_dialog_map: assertion failed: (++count < 10)
Abandon
Comment 9 Xavier Claessens 2010-03-08 12:28:07 UTC
Adding Mathias Clasen in CC, he seems to be the one who wrote that code, according to git-blame.
Comment 10 Xavier Claessens 2010-03-08 12:31:39 UTC
Also note that if I change the link label to be only "<a href=\"http://www.test.com\">www.test.com</a>" then I can't reproduce the infinite loop, but the first label is selected. I remember we had issues like that in Empathy where label gets selected.
Comment 11 Xavier Claessens 2010-03-08 13:19:41 UTC
So I see 2 issues:

1) The focus does not forward in label that have links
2) If there are only labels in the dialog that can get the focus, it should not select the first, but fallback to no focus.
Comment 12 Xavier Claessens 2010-03-08 14:00:38 UTC
3) In testcase, if I show the dialog before packing labels to avoid the freeze, then taping "tab" to move focus will only select the whole label that contains the link, it won't select just the link. If I don't set that label as selectable, then only the link will be selected.

So it really looks like gtk_label_focus() has issues.
Comment 13 Xavier Claessens 2010-03-08 14:23:44 UTC
I've found what's going on with the infinite loop:

In gtk_dialog_map() if the focus goes to a label, then it select [0, 0] area. That means that in the label, info->selection_anchor == info->selection_end. In that case, when taking the next focus, it stay in the label and search for next link... but since the area is always reset to [0,0] it will always take first link as next focus.

So the loop in gtk_dialog_map() will never come back to the first_focus, and it will loop infinitely.

Raising severity to critical since it can easily freeze any GTK app.
Comment 14 Xavier Claessens 2010-03-08 16:08:58 UTC
I backported the patch to GTK 2.18 and it fixed the issue. Thank!