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 331683 - Context menu for URLs is racy
Context menu for URLs is racy
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-02-18 15:28 UTC by Sebastien Bacher
Modified: 2008-10-09 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2006-02-18 15:28:15 UTC
That bug has been described on https://launchpad.net/distros/ubuntu/+source/gnome-terminal/+bug/28956

"Right-clicking on a URL in a terminal, but accidentally moving the mouse cursor off the URL before the context menu renders (it's easier than it sounds, at least on my hardware) produces a different context menu than if the cursor stays put. Specifically, the "Open Link" and "Copy Link Address" options are missing.



It appears that the contents of the menu are determined more by where the mouse cursor is at rendering time than where it was when the right mouse button was clicked. So not only will "Copy Link Address" be missing if the cursor happens to move off the URL you clicked on, it will in fact be present, and copy the wrong URL into the clipboard, if you are unlucky enough to move the cursor over a different URL before the menu appears.

For some reason, I trip over this bug almost every day."
Comment 1 Behdad Esfahbod 2006-02-18 18:04:10 UTC
I hit this bug quite regulartly too.
Comment 2 Thomas Folz-Donahue 2006-07-31 17:49:58 UTC
Even better.  Try this- cat two URLs to a file, or something, to get them right next to each other on screen.  Click on one while moving the mouse over the other.  What should happen is, the one you clicked on gets opened.  But all too often, the one you didn't click on gets opened.

The way opening a URL works is,
	  menu_item = append_menuitem (screen->priv->popup_menu,
				       _("_Open Link"),
				       G_CALLBACK (open_url_callback),
				       screen);

In other words, it passes the entire screen state off to a callback, not just the matched_string.  At first, I thought a potential fix would be to save screen->priv->matched_string and screen->priv->matched_flavor as soon as possible, passing the saved values on instead of whatever the mouse is currently hovering over.  But it looks like, because these callbacks are everywhere, that such a solution would be more complicated than I'd like to implement without further discussion.
Comment 3 Christian Persch 2008-03-25 14:17:05 UTC
Is this still reproducible in gnome-terminal from svn trunk?
Comment 4 Christian Persch 2008-06-28 18:22:22 UTC
No response; closing INCOMPLETE.
Comment 5 Thomas Folz-Donahue 2008-06-28 19:46:51 UTC
This bug is still reproducible in 2.22.1, which ships with Ubuntu 8.04 (it's sometimes difficult to build trunk in a distro :3 ).  All you need to do to verify this bug is click on a URL and move your mouse off it before the menu is rendered, though I guess if you have a really fast computer it might be harder (can reproduce with a 1.9GHz dual-core Turion64).
Comment 6 André Klapper 2008-06-28 19:50:11 UTC
reopen as per last comment
Comment 7 Christian Persch 2008-06-28 20:24:48 UTC
I was asking about svn trunk. (Personally I can't repro this on trunk or 2.22.)
Comment 8 André Klapper 2008-06-29 02:39:48 UTC
Yeah, I know that. However I don't expect every average user to compile from trunk, and the information that the bug IS present at least in 2.22 is something valuable, compared to two years of silence in this ticket.
Comment 9 Christian Persch 2008-06-29 11:04:09 UTC
The code, though different between 2.22 and svn trunk, does in both versions use the coordinates from the button press event to get the URL match string from vte. The possible delay of opening the context menu is only introduced after that, by getting the list of clipboard targets asynchronously. So if this bug exists, it must be that the event coordinates of the button press event are wrong. Can someone who can repro the bug put a few printf's into terminal_screen_button_press in src/terminal-screen.c to print the |matched_string| variable before emitting the context menu signal, and see if it's as expected or wrong?
Comment 10 Behdad Esfahbod 2008-06-29 17:13:14 UTC
I can't seem to be able to reproduce with trunk.
Comment 11 Thomas Folz-Donahue 2008-06-29 20:54:50 UTC
>the event coordinates of the button press event are wrong

This does happen in IRC that the terminal window will scroll before the context menu appears.

So I finally managed to build and install intltool-0.40 (checkinstall ftw), but gnome-terminal trunk doesn't pop up any contextual menus at all.  Do I need to run it outside of the src directory it got built in?  This is trunk as of yesterday.
Comment 12 Christian Persch 2008-06-29 21:09:25 UTC
Well so what must happen is that you think you click on the URL, but actually just 1 nanosecond before the click registers the terminal has scrolled and thus the click goes to the new line under the mouse pointer, which has no URL. The fact that the popup has a delay in appearing has nothing to do with this.

(Did you "make install"? Any warnings on console when starting "gnome-terminal --disable-factory" ?)
Comment 13 Christian Persch 2008-10-09 14:45:55 UTC
Ping? Can you still repro this in g-t 2.24.0 ? 
Comment 14 Thomas Folz-Donahue 2008-10-09 20:53:00 UTC
I'm using gnome-terminal 2.24 on Ubuntu Intrepid.  After renicing gnome-terminal to +10 and starting two cat /dev/urandom | gzip | uuencode - processes (to waste CPU resources), I was able to get the context menu to open after I moved the mouse cursor away from the URL.  "Open link" still appeared in the context menu and behaved appropriately.

So, no, this bug is not reproducible with 2.24