diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-03-04 07:50:49 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-03-07 13:05:26 +1000 |
commit | b4a74bcebc8f1d37b2ed78db3440435ead03299a (patch) | |
tree | 6ba3ebd878c8201b8338531896b1a61e889d2ea4 | |
parent | 00a9b05da71c9071cc910a1c5975165f2a8db9c6 (diff) | |
download | libinput-b4a74bcebc8f1d37b2ed78db3440435ead03299a.tar.gz |
Assert that the interface is actually filled in.
Had this in a private bug report recently. Missing hooks for open/close just
segfault with little information to debug. Add an assert, this is definitely a
bug in the caller and we don't need to recover from that.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/libinput.c | 3 | ||||
-rw-r--r-- | test/udev.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/libinput.c b/src/libinput.c index 3c78905f..14808780 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -1517,6 +1517,9 @@ libinput_init(struct libinput *libinput, const struct libinput_interface_backend *interface_backend, void *user_data) { + assert(interface->open_restricted != NULL); + assert(interface->close_restricted != NULL); + libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);; if (libinput->epoll_fd < 0) return -1; diff --git a/test/udev.c b/test/udev.c index 30ae1180..9296e94c 100644 --- a/test/udev.c +++ b/test/udev.c @@ -52,7 +52,6 @@ const struct libinput_interface simple_interface = { START_TEST(udev_create_NULL) { struct libinput *li; - const struct libinput_interface interface; struct udev *udev; udev = udev_new(); @@ -60,13 +59,13 @@ START_TEST(udev_create_NULL) li = libinput_udev_create_context(NULL, NULL, NULL); ck_assert(li == NULL); - li = libinput_udev_create_context(&interface, NULL, NULL); + li = libinput_udev_create_context(&simple_interface, NULL, NULL); ck_assert(li == NULL); li = libinput_udev_create_context(NULL, NULL, udev); ck_assert(li == NULL); - li = libinput_udev_create_context(&interface, NULL, udev); + li = libinput_udev_create_context(&simple_interface, NULL, udev); ck_assert(li != NULL); ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1); |