mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-05 13:20:28 +01:00
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>
This commit is contained in:
parent
00a9b05da7
commit
b4a74bcebc
2 changed files with 5 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue