GNOME Bugzilla – Bug 771858
wayland: Don't crash after VT switching while popup is open
Last modified: 2016-10-12 02:52:40 UTC
If we VT switch when a popup is open, we crash. The reason is that when switching away, all input classes are removed, meaning unset focus and end any pointer grab. The popup grab was not notified about this, so when a popup is dismissed, it won't know it doesn't have the grab anymore, and crashes as a result. Fix this by introducing a 'cancel' vfunc to the pointer grab interface, dismissing the popup grab if the grab is cancelled.
Created attachment 336132 [details] [review] wayland/pointer: Add way to cancel current grab Previously a grab could suddenly end without the grabber knowing anything about it. Some grabs assume they won't suddenly end without notice, and can use then new 'cancel' vfunc to be notified. Currently a grab is cancelled when a new one is started (i.e. in meta_wayland_pointer_grab_start()), when a non-popup compositor wide event route is initiated, and when the seat looses the pointer capability.
Created attachment 336133 [details] [review] MetaWaylandPopup: Dismiss popup when grab is cancelled Dismiss the popup when the grab is cancelled, so that if the grab is ended for whatever reason (such as VT switching or the last pointer being disconnected), it doesn't try to end the grab when it isn't active. This fixes a crash when VT switching back and forth while a popup grab is active.
Review of attachment 336132 [details] [review]: looks good
Review of attachment 336133 [details] [review]: right
Attachment 336132 [details] pushed as 6e70574 - wayland/pointer: Add way to cancel current grab Attachment 336133 [details] pushed as 9de6de5 - MetaWaylandPopup: Dismiss popup when grab is cancelled