Add two asserts to avoid underrunning the seat/device refcount
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 8 Jan 2014 06:40:14 +0000 (16:40 +1000)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 8 Jan 2014 19:45:58 +0000 (20:45 +0100)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/libinput.c

index 06b7263..550ca94 100644 (file)
@@ -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);