mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 19:50:25 +01:00
Add two asserts to avoid underrunning the seat/device refcount
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c0ac1ef9f2
commit
ded615c64f
1 changed files with 2 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue