From: Peter Hutterer Date: Wed, 8 Jan 2014 06:40:14 +0000 (+1000) Subject: Add two asserts to avoid underrunning the seat/device refcount X-Git-Tag: 0.1.0~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ded615c64f5a73f0d3264dcecdcc93165817c024;p=platform%2Fupstream%2Flibinput.git Add two asserts to avoid underrunning the seat/device refcount Signed-off-by: Peter Hutterer --- 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);