[gtk+] wayland: Compare serial numbers correctly to avoid overflow problems
- From: Kristian Høgsberg <krh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Compare serial numbers correctly to avoid overflow problems
- Date: Sat, 24 Aug 2013 06:16:44 +0000 (UTC)
commit 771dbe059248a6f263ec72aa41f1f54f21d94208
Author: Kristian Høgsberg <krh bitplanet net>
Date: Fri Aug 23 23:08:13 2013 -0700
wayland: Compare serial numbers correctly to avoid overflow problems
We have to look at the difference between two numbers, which will always
be well-defined and give the right result, even in case of integer overflow.
gdk/wayland/gdkdisplay-wayland.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index db47bfe..e9424b2 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -678,8 +678,12 @@ void
_gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display,
guint32 serial)
{
- if (serial > wayland_display->serial)
+ if (serial - wayland_display->serial < 1000)
wayland_display->serial = serial;
+ else
+ g_warning (G_STRLOC ": serial number jump bigger than 1000 (%u -> %u",
+ wayland_display->serial, serial);
+
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]