mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-07 22:28:09 +02: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,
|
const struct libinput_interface_backend *interface_backend,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
|
assert(interface->open_restricted != NULL);
|
||||||
|
assert(interface->close_restricted != NULL);
|
||||||
|
|
||||||
libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);;
|
libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);;
|
||||||
if (libinput->epoll_fd < 0)
|
if (libinput->epoll_fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ const struct libinput_interface simple_interface = {
|
||||||
START_TEST(udev_create_NULL)
|
START_TEST(udev_create_NULL)
|
||||||
{
|
{
|
||||||
struct libinput *li;
|
struct libinput *li;
|
||||||
const struct libinput_interface interface;
|
|
||||||
struct udev *udev;
|
struct udev *udev;
|
||||||
|
|
||||||
udev = udev_new();
|
udev = udev_new();
|
||||||
|
|
@ -60,13 +59,13 @@ START_TEST(udev_create_NULL)
|
||||||
li = libinput_udev_create_context(NULL, NULL, NULL);
|
li = libinput_udev_create_context(NULL, NULL, NULL);
|
||||||
ck_assert(li == 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);
|
ck_assert(li == NULL);
|
||||||
|
|
||||||
li = libinput_udev_create_context(NULL, NULL, udev);
|
li = libinput_udev_create_context(NULL, NULL, udev);
|
||||||
ck_assert(li == NULL);
|
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(li != NULL);
|
||||||
ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1);
|
ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue