From ded615c64f5a73f0d3264dcecdcc93165817c024 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Jan 2014 16:40:14 +1000 Subject: [PATCH] Add two asserts to avoid underrunning the seat/device refcount Signed-off-by: Peter Hutterer --- src/libinput.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libinput.c b/src/libinput.c index 06b7263..550ca94 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -504,6 +504,7 @@ libinput_seat_destroy(struct libinput_seat *seat) LIBINPUT_EXPORT void libinput_seat_unref(struct libinput_seat *seat) { + assert(seat->refcount > 0); seat->refcount--; if (seat->refcount == 0) libinput_seat_destroy(seat); @@ -550,6 +551,7 @@ libinput_device_destroy(struct libinput_device *device) LIBINPUT_EXPORT void libinput_device_unref(struct libinput_device *device) { + assert(device->refcount > 0); device->refcount--; if (device->refcount == 0) libinput_device_destroy(device); -- 2.7.4