Problems with grab tracking for popups
By wiggling the mouse while right clicking on a text view, I can get a context menu that doesn't go away when I click on the application window outside the menu. It still goes away when I click on the desktop.
Adding some printfs to the relevant code paths yields:
new popup 0x13d4300 autohide 1 add grab on popup 0x13d4300 add grab on popup 0x13d4300 check_autohide on toplevel 0x16ce3d0 hide popup chain
new popup 0x20902e0 autohide 1 add grab on popup 0x20902e0 add grab on popup 0x20902e0 add grab on toplevel 0x23a83f0 check_autohide on toplevel 0x23a83f0
So an extra grab on the toplevel sneaks in, and then of course, the autohide check doesn't trigger anymore, since we find grab info for the toplevel surface.