mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
display: Make sure ping serials are never reused
Using a timestamp twice in a row (e.g. when activating two windows in response to the same event or due to other bugs) will break the window detection and show a close dialog on the wrong window. This is a grave error that should never happen, so check every timestamp before sending the ping for uniqueness and if the timestamp was already used and its ping is still pending, log a warning message and don't send the ping. https://gitlab.gnome.org/GNOME/mutter/merge_requests/891
This commit is contained in:
parent
0bf9727a31
commit
9b58033375
@ -2063,6 +2063,7 @@ void
|
||||
meta_display_ping_window (MetaWindow *window,
|
||||
guint32 serial)
|
||||
{
|
||||
GSList *l;
|
||||
MetaDisplay *display = window->display;
|
||||
MetaPingData *ping_data;
|
||||
|
||||
@ -2076,6 +2077,19 @@ meta_display_ping_window (MetaWindow *window,
|
||||
if (!meta_window_can_ping (window))
|
||||
return;
|
||||
|
||||
for (l = display->pending_pings; l; l = l->next)
|
||||
{
|
||||
MetaPingData *ping_data = l->data;
|
||||
|
||||
if (serial == ping_data->serial)
|
||||
{
|
||||
meta_warning ("Ping serial %u was reused for window %s, "
|
||||
"previous use was for window %s.\n",
|
||||
serial, window->desc, ping_data->window->desc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ping_data = g_new (MetaPingData, 1);
|
||||
ping_data->window = window;
|
||||
ping_data->serial = serial;
|
||||
|
Loading…
Reference in New Issue
Block a user