window: Fix sending button events when there's no grab
authorNeil Roberts <neil@linux.intel.com>
Mon, 23 Jan 2012 19:11:18 +0000 (19:11 +0000)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 24 Jan 2012 16:25:15 +0000 (11:25 -0500)
commit6b28aadd479377f390eb0e5c596d8b576b429643
tree524d7cb61b074e033f83a707ca8df2f8f7e29c5e
parenta12d6113cee529e5c3e20ea182163e512305e867
window: Fix sending button events when there's no grab

The code which sends the button events was checking whether there is a
focus widget with a button handler but then always sending the button
event to the grab widget. If the grab widget is different from the
focus widget at this point then it will check the wrong widget for a
button handler and potentially crash. It is also possible for there to
be no grab widget here in the following situation:

1. Press and hold down the left mouse button
2. Press and hold down the right mouse button
3. Release the left mouse button
4. Release the right mouse button

In this case the grab will be released at step 3 because the code only
keeps track of the grab for one button. Then it will try to send the
release event for the right mouse button to a NULL widget so it will
crash.
clients/window.c